runtime (chan): fix blocking select on a nil channel

Previously, a blocking select on a nil channel would result in a nil panic inside the channel runtime code.
This change fixes the nil checks so that the select works as intended.
This commit is contained in:
Jaden Weiss
2020-04-12 19:08:44 -04:00
committed by Ron Evans
parent 9890c760cf
commit 9c78f7039d
2 changed files with 14 additions and 3 deletions
+2
View File
@@ -134,6 +134,8 @@ func main() {
select {
case make(chan int) <- 3:
println("unreachable")
case <-(chan int)(nil):
println("unreachable")
case n := <-ch:
println("select n from chan:", n)
case n := <-make(chan int):