diff options
Diffstat (limited to 'libgo/runtime/go-map-index.c')
-rw-r--r-- | libgo/runtime/go-map-index.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libgo/runtime/go-map-index.c b/libgo/runtime/go-map-index.c index a387c4b98bc..92a806868bc 100644 --- a/libgo/runtime/go-map-index.c +++ b/libgo/runtime/go-map-index.c @@ -9,6 +9,7 @@ #include "go-alloc.h" #include "go-assert.h" +#include "go-panic.h" #include "map.h" /* Rehash MAP to a larger size. */ @@ -85,6 +86,13 @@ __go_map_index (struct __go_map *map, const void *key, _Bool insert) size_t bucket_index; char *entry; + if (map == NULL) + { + if (insert) + __go_panic_msg ("assignment to entry in nil map"); + return NULL; + } + descriptor = map->__descriptor; key_descriptor = descriptor->__map_descriptor->__key_type; |