@@ -406,7 +406,9 @@ func hashmapNext(m *hashmap, it *hashmapIterator, key, value unsafe.Pointer) boo
406
406
407
407
// Hashmap with plain binary data keys (not containing strings etc.).
408
408
func hashmapBinarySet (m * hashmap , key , value unsafe.Pointer ) {
409
- // TODO: detect nil map here and throw a better panic message?
409
+ if m == nil {
410
+ nilMapPanic ()
411
+ }
410
412
hash := hash32 (key , uintptr (m .keySize ), m .seed )
411
413
hashmapSet (m , key , value , hash )
412
414
}
@@ -445,6 +447,9 @@ func hashmapStringPtrHash(sptr unsafe.Pointer, size uintptr, seed uintptr) uint3
445
447
}
446
448
447
449
func hashmapStringSet (m * hashmap , key string , value unsafe.Pointer ) {
450
+ if m == nil {
451
+ nilMapPanic ()
452
+ }
448
453
hash := hashmapStringHash (key , m .seed )
449
454
hashmapSet (m , unsafe .Pointer (& key ), value , hash )
450
455
}
@@ -561,6 +566,9 @@ func hashmapInterfaceEqual(x, y unsafe.Pointer, n uintptr) bool {
561
566
}
562
567
563
568
func hashmapInterfaceSet (m * hashmap , key interface {}, value unsafe.Pointer ) {
569
+ if m == nil {
570
+ nilMapPanic ()
571
+ }
564
572
hash := hashmapInterfaceHash (key , m .seed )
565
573
hashmapSet (m , unsafe .Pointer (& key ), value , hash )
566
574
}
0 commit comments