Skip to content

Commit

Permalink
Dont run player methods if player is NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
wrefgtzweve committed Sep 20, 2024
1 parent ee7e76e commit 0a4ff21
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lua/weapons/remotecontroller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,18 @@ end

function SWEP:Off()
local ply = self:GetOwner()
local validPly = IsValid(ply)

if self.Active then
if validPly and self.Active then
ply:SetMoveType(self.OldMoveType or MOVETYPE_WALK)
end

self.Active = nil
self.OldMoveType = nil
ply:DrawViewModel(true)
ply.using_wire_remote_control = false
if validPly then
ply:DrawViewModel(true)
ply.using_wire_remote_control = false
end

if IsValid(self.Linked) and self.Linked:GetPly() == ply then
self.Linked:PlayerExited()
Expand Down

0 comments on commit 0a4ff21

Please sign in to comment.