runtime: Delete from a nil map is now a no-op.

From-SVN: r194462
This commit is contained in:
Ian Lance Taylor 2012-12-12 23:29:10 +00:00
parent 8318d4ce56
commit 35f33e3802
2 changed files with 3 additions and 4 deletions

View File

@ -151,9 +151,8 @@ func maptest() {
shouldPanic(func() {
m[2] = 3
})
shouldPanic(func() {
delete(m, 2)
})
// can delete (non-existent) entries
delete(m, 2)
}
// nil slice

View File

@ -27,7 +27,7 @@ __go_map_delete (struct __go_map *map, const void *key)
void **pentry;
if (map == NULL)
runtime_panicstring ("deletion of entry in nil map");
return;
descriptor = map->__descriptor;