mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
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:
Vendored
+2
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user