From 214b025cde1410c0f4a5fea5797f11746e8fd315 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Fri, 20 Feb 2026 19:44:49 +0300 Subject: [PATCH] Fix lua error Fixes: ``` - addons/wire/lua/entities/gmod_wire_spu/cl_init.lua:59: Tried to use a NULL entity! 1. SetNoDraw - [C]:-1 2. Function - addons/wire/lua/entities/gmod_wire_spu/cl_init.lua:59 3. - lua/includes/modules/usermessage.lua:80 ``` There may be a better solution, but i still don't understand the zcpu structure very well --- lua/entities/gmod_wire_spu/cl_init.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/entities/gmod_wire_spu/cl_init.lua b/lua/entities/gmod_wire_spu/cl_init.lua index de014be929..0155af6f94 100644 --- a/lua/entities/gmod_wire_spu/cl_init.lua +++ b/lua/entities/gmod_wire_spu/cl_init.lua @@ -55,9 +55,13 @@ local function SPU_SoundSources(um) if not SPU:IsValid() then return end for i=0,WireSPU_MaxChannels-1 do - SPU.SoundSources[i] = ents.GetByIndex(um:ReadLong()) - SPU.SoundSources[i]:SetNoDraw(true) - SPU.SoundSources[i]:SetModelScale(0,0) + local soundsource = ents.GetByIndex(um:ReadLong()) + + if soundsource:IsValid() then + SPU.SoundSources[i] = soundsource + SPU.SoundSources[i]:SetNoDraw(true) + SPU.SoundSources[i]:SetModelScale(0,0) + end end -- Reset VM