From 1dab017abe17bcbabf9ee7f19e87896e91387010 Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Wed, 14 Apr 2021 16:21:16 +0200 Subject: [PATCH] Fix possible crash and wireless receptors in unloaded map blocks (#22) Co-authored-by: sys4 --- moremesecons_wireless/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/moremesecons_wireless/init.lua b/moremesecons_wireless/init.lua index 28623ed..9c887df 100644 --- a/moremesecons_wireless/init.lua +++ b/moremesecons_wireless/init.lua @@ -262,6 +262,9 @@ local function on_digiline_receive(pos, node, channel, msg) end local wls = moremesecons.get_data_from_pos(wireless_meta, pos) + if not wls then + return + end if wls.owner == "" or not wireless[wls.owner] or channel == "" or not wireless[wls.owner][wls.channel] then return @@ -274,7 +277,7 @@ local function on_digiline_receive(pos, node, channel, msg) sending_digilines[pos_hash] = true for i, wl_pos in pairs(wireless[wls.owner][wls.channel].members) do - if i ~= wls.id and check_wireless_exists(wl_pos) then + if i ~= wls.id then digiline:receptor_send(wl_pos, digiline.rules.default, channel, msg) end end