From 4043be85678e979996286c5269cfa35a7f10edac Mon Sep 17 00:00:00 2001 From: Jack Mordaunt Date: Sun, 8 Jun 2025 18:29:26 -0300 Subject: [PATCH] core/sync/chan.try_select_raw: skip nil input messages This makes the proc easier and safer to call by letting the caller nil out messages to skip sends. --- core/sync/chan/chan.odin | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/sync/chan/chan.odin b/core/sync/chan/chan.odin index f8f3ac46e..2c34f7bb3 100644 --- a/core/sync/chan/chan.odin +++ b/core/sync/chan/chan.odin @@ -1205,7 +1205,10 @@ try_select_raw :: proc "odin" (recvs: []^Raw_Chan, sends: []^Raw_Chan, send_msgs } for c, i in sends { - if can_send(c) { + if i > builtin.len(send_msgs)-1 || send_msgs[i] == nil { + continue + } + if can_send(c) { candidates[count] = { is_recv = false, idx = i,