From 09367c0d60f551d7d05b6212b649a71636b623ce Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 25 Oct 2011 16:35:24 +0000 Subject: Don't permit close of receive-only channel. Better panic on attempt to close nil channel. From-SVN: r180437 --- libgo/runtime/go-close.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libgo') diff --git a/libgo/runtime/go-close.c b/libgo/runtime/go-close.c index 44533eb..778eab3 100644 --- a/libgo/runtime/go-close.c +++ b/libgo/runtime/go-close.c @@ -16,6 +16,9 @@ __go_builtin_close (struct __go_channel *channel) { int i; + if (channel == NULL) + __go_panic_msg ("close of nil channel"); + i = pthread_mutex_lock (&channel->lock); __go_assert (i == 0); -- cgit v1.1