fix: guard against null entry array in wrenMapFind for empty maps

Add early return of UINT32_MAX when map capacity is zero in wrenMapFind,
preventing a crash from modulo operation on zero during hash index calculation.
Includes regression test verifying subscript access on empty map returns null.
This commit is contained in:
Bob Nystrom
2015-01-29 03:19:04 +00:00
parent ad6d777fe0
commit 7d333d2b82
2 changed files with 7 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
// This is a regression test to ensure map handles a null entry array.
var map = {}
IO.print(map["key"]) // expect: null