Skip to content

Commit 97bfe3a

Browse files
authored
Fix lua error (#3646)
Fixes: ``` - lua/autorun/server/sv_cpp.lua:7: attempt to index a nil value 1. GetOwner - lua/autorun/server/sv_cpp.lua:7 2. CanTool - lua/autorun/sh_cpp.lua:5 3. RightClick - addons/wire/lua/wire/stools/hydraulic.lua:181 4. <unknown> - gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua:273 ``` Not prop protection issue, it's because WireLib.CanTool pushes NULL ent
1 parent b899731 commit 97bfe3a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lua/wire/stools/hydraulic.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function TOOL:RightClick( trace )
178178
end
179179
local trace2 = util.TraceLine( tr )
180180

181-
if CLIENT or not WireLib.CanTool(self:GetOwner(), trace2.Entity, "wire_hydraulic") then return false end
181+
if CLIENT or not trace2.Entity:IsValid() or not WireLib.CanTool(self:GetOwner(), trace2.Entity, "wire_hydraulic") then return false end
182182

183183
return self:LeftClick(trace) and self:LeftClick(trace2)
184184
end

0 commit comments

Comments
 (0)