Skip to content

Commit

Permalink
Check PhysObj comparison edge case
Browse files Browse the repository at this point in the history
Should close #390
  • Loading branch information
thecraftianman committed Feb 20, 2024
1 parent 9181811 commit 81164f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/acf/core/validation_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function ACF.IsLegal(Entity)

local Phys = Entity:GetPhysicsObject()

if Entity.ACF.PhysObj ~= Phys then
if not IsValid(Entity.ACF.PhysObj) or Entity.ACF.PhysObj ~= Phys then
if Phys:GetVolume() then
Entity.ACF.PhysObj = Phys -- Updated PhysObj
else
Expand Down Expand Up @@ -204,7 +204,7 @@ function ACF.Check(Entity, ForceUpdate) -- IsValid but for ACF
end

ACF.Activate(Entity)
elseif ForceUpdate or Entity.ACF.Mass ~= PhysObj:GetMass() or Entity.ACF.PhysObj ~= PhysObj then
elseif ForceUpdate or Entity.ACF.Mass ~= PhysObj:GetMass() or (not IsValid(Entity.ACF.PhysObj) or Entity.ACF.PhysObj ~= PhysObj) then
ACF.Activate(Entity, true)
end

Expand Down

0 comments on commit 81164f1

Please sign in to comment.