From: Russ Cox Date: Mon, 20 Sep 2010 03:28:12 +0000 (-0400) Subject: runtime: better panic for send to nil channel X-Git-Tag: weekly.2010-09-22~37 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d4baf3ccb7f7b6dd5476b82c480f30d3a2953399;p=gostls13.git runtime: better panic for send to nil channel *Much* better on NaCl, where memory faults are deadly. R=r CC=golang-dev https://golang.org/cl/2249041 --- diff --git a/src/pkg/runtime/chan.c b/src/pkg/runtime/chan.c index 16c02e8e78..436f8b1401 100644 --- a/src/pkg/runtime/chan.c +++ b/src/pkg/runtime/chan.c @@ -403,6 +403,9 @@ void int32 o; byte *ae; + if(c == nil) + panicstring("send to nil channel"); + o = rnd(sizeof(c), c->elemalign); ae = (byte*)&c + o; chansend(c, ae, nil); @@ -416,6 +419,9 @@ void int32 o; byte *ae, *ap; + if(c == nil) + panicstring("send to nil channel"); + o = rnd(sizeof(c), c->elemalign); ae = (byte*)&c + o; o = rnd(o+c->elemsize, Structrnd);