diff options
author | Russ Cox <rsc@golang.org> | 2010-07-13 17:27:26 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-07-13 17:27:26 -0700 |
commit | cec007d3d25df721e86ab08925133db637dad609 (patch) | |
tree | f88d1fb5dac6a207a7ba5b601fc938aedb3bc1ab | |
parent | 041d11623f0332feacb15d3e10e29eec8c64200f (diff) | |
download | go-cec007d3d25df721e86ab08925133db637dad609.tar.gz go-cec007d3d25df721e86ab08925133db637dad609.zip |
runtime: better error for send/recv on nil channel
R=ken2
CC=golang-dev
https://golang.org/cl/1835041
-rw-r--r-- | src/pkg/runtime/chan.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/runtime/chan.c b/src/pkg/runtime/chan.c index 08cd75a6e5..9e88e824a4 100644 --- a/src/pkg/runtime/chan.c +++ b/src/pkg/runtime/chan.c @@ -182,6 +182,9 @@ chansend(Hchan *c, byte *ep, bool *pres) SudoG *sg; G* gp; + if(c == nil) + panicstring("send to nil channel"); + if(gcwaiting) gosched(); @@ -286,6 +289,9 @@ chanrecv(Hchan* c, byte *ep, bool* pres) SudoG *sg; G *gp; + if(c == nil) + panicstring("receive from nil channel"); + if(gcwaiting) gosched(); |