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.
This commit is contained in:
Jack Mordaunt
2025-06-08 18:29:26 -03:00
parent fb39e5a2f8
commit 4043be8567

View File

@@ -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,