Skip to content

Commit 00add36

Browse files
authored
Fix lua error (#3498)
* Fix lua error Fixes: ``` - addons/wire/lua/wire/stools/trigger.lua:67: Tried to use a NULL entity! 1. GetPos - [C]:-1 2. DrawTriggerOutlines - addons/wire/lua/wire/stools/trigger.lua:67 3. DrawHUD - addons/wire/lua/wire/stools/trigger.lua:83 4. drawhud - gamemodes/sandbox/entities/weapons/gmod_tool/cl_init.lua:61 5. <unknown> - addons/classicbox-scripts-main/lua/autorun/client/cl_misc.lua:101 ``` * Minor styling * Minor styling
1 parent ba3bb4d commit 00add36

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lua/wire/stools/trigger.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ function TOOL:GetConVars()
6060
end
6161

6262
local function DrawTriggerOutlines( list )
63-
cam.Start3D( EyePos(), EyeAngles() )
64-
for k,ent in pairs( list ) do
65-
local trig = ent:GetTriggerEntity()
66-
67-
render.DrawWireframeBox( trig:GetPos(), Angle(0,0,0), trig:OBBMins(), trig:OBBMaxs(), Color( 255, 255, 0 ), true )
68-
render.DrawLine( trig:GetPos(), ent:GetPos(), Color( 255, 255, 0 ) )
63+
cam.Start3D(EyePos(), EyeAngles())
64+
for k, ent in ipairs(list) do
65+
local trigger = ent:GetTriggerEntity()
66+
67+
if trigger:IsValid() then
68+
render.DrawWireframeBox(trigger:GetPos(), angle_zero, trigger:OBBMins(), trigger:OBBMaxs(), Color(255, 255, 0), true)
69+
render.DrawLine(trigger:GetPos(), ent:GetPos(), Color(255, 255, 0))
70+
end
6971
end
7072
cam.End3D()
7173
end

0 commit comments

Comments
 (0)