From b6085e58373778cf2a9ac98acc0f6e4cb2fe588b Mon Sep 17 00:00:00 2001 From: thegrb93 Date: Sun, 9 Feb 2025 21:04:14 -0500 Subject: [PATCH] Apparently nil Inputs/Outputs is supposed to be valid (#3260) --- lua/wire/wireshared.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lua/wire/wireshared.lua b/lua/wire/wireshared.lua index e22f1b4b..697e57f6 100644 --- a/lua/wire/wireshared.lua +++ b/lua/wire/wireshared.lua @@ -617,29 +617,31 @@ if SERVER then function WireLib._SetInputs(ent) local eid = ent:EntIndex() local inputs = ent.Inputs - if not inputs then return end local ent_input_array = {} ents_with_inputs[eid] = ent_input_array - for Name, CurPort in pairs_sortvalues(inputs, WireLib.PortComparator) do - ent_input_array[#ent_input_array+1] = { Name, CurPort.Type, CurPort.Desc or "", CurPort.Num } + if inputs then + for Name, CurPort in pairs_sortvalues(inputs, WireLib.PortComparator) do + ent_input_array[#ent_input_array+1] = { Name, CurPort.Type, CurPort.Desc or "", CurPort.Num } + end + SendPortInfo(WirePortQueue, eid, PORT_TYPE_INPUT, inputs) end - SendPortInfo(WirePortQueue, eid, PORT_TYPE_INPUT, inputs) end function WireLib._SetOutputs(ent) local eid = ent:EntIndex() local outputs = ent.Outputs - if not outputs then return end local ent_output_array = {} ents_with_outputs[eid] = ent_output_array - for Name, CurPort in pairs_sortvalues(outputs, WireLib.PortComparator) do - ent_output_array[#ent_output_array+1] = { Name, CurPort.Type, CurPort.Desc or "", CurPort.Num } + if outputs then + for Name, CurPort in pairs_sortvalues(outputs, WireLib.PortComparator) do + ent_output_array[#ent_output_array+1] = { Name, CurPort.Type, CurPort.Desc or "", CurPort.Num } + end + SendPortInfo(WirePortQueue, eid, PORT_TYPE_OUTPUT, outputs) end - SendPortInfo(WirePortQueue, eid, PORT_TYPE_OUTPUT, outputs) end function WireLib._SetLink(input)