Commit f2852ba6 authored by Russ Cox's avatar Russ Cox

runtime: descriptive panics for use of nil map

R=r, r2
CC=golang-dev
https://golang.org/cl/4173060
parent 71288891
......@@ -781,6 +781,9 @@ runtime·mapaccess(Hmap *h, byte *ak, byte *av, bool *pres)
{
byte *res;
if(h == nil)
runtime·panicstring("lookup in nil map");
if(runtime·gcwaiting)
runtime·gosched();
......@@ -802,6 +805,9 @@ runtime·mapaccess1(Hmap *h, ...)
byte *ak, *av;
bool pres;
if(h == nil)
runtime·panicstring("lookup in nil map");
ak = (byte*)&h + h->ko1;
av = (byte*)&h + h->vo1;
......@@ -827,6 +833,9 @@ runtime·mapaccess2(Hmap *h, ...)
{
byte *ak, *av, *ap;
if(h == nil)
runtime·panicstring("lookup in nil map");
ak = (byte*)&h + h->ko1;
av = (byte*)&h + h->vo1;
ap = (byte*)&h + h->po1;
......@@ -852,6 +861,9 @@ runtime·mapassign(Hmap *h, byte *ak, byte *av)
byte *res;
int32 hit;
if(h == nil)
runtime·panicstring("assignment to entry in nil map");
if(runtime·gcwaiting)
runtime·gosched();
......@@ -889,6 +901,9 @@ runtime·mapassign1(Hmap *h, ...)
{
byte *ak, *av;
if(h == nil)
runtime·panicstring("assignment to entry in nil map");
ak = (byte*)&h + h->ko2;
av = (byte*)&h + h->vo2;
......@@ -902,6 +917,9 @@ runtime·mapassign2(Hmap *h, ...)
{
byte *ak, *av, *ap;
if(h == nil)
runtime·panicstring("assignment to entry in nil map");
ak = (byte*)&h + h->ko2;
av = (byte*)&h + h->vo2;
ap = (byte*)&h + h->po2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment