Skip to content

Commit

Permalink
'Game object has been destroyed'
Browse files Browse the repository at this point in the history
  • Loading branch information
Strogoo authored and aeoncleanse committed Jun 11, 2018
1 parent cea6783 commit 7aeb852
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/defaultunits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2032,7 +2032,7 @@ ConstructionUnit = Class(MobileUnit) {
-- as it doesn't know it's doing something bad. To fix it, we temporarily make the unit immobile when it starts construction.
if self:IsMoving() then
self:SetImmobile(true)
ForkThread(function() WaitTicks(1) self:SetImmobile(false) end)
ForkThread(function() WaitTicks(1) if not self:BeenDestroyed() then self:SetImmobile(false) end end)
end
end,

Expand Down Expand Up @@ -2145,7 +2145,7 @@ CommandUnit = Class(WalkingLandUnit) {
-- as it doesn't know it's doing something bad. To fix it, we temporarily make the unit immobile when it starts construction.
if self:IsMoving() then
self:SetImmobile(true)
ForkThread(function() WaitTicks(1) self:SetImmobile(false) end)
ForkThread(function() WaitTicks(1) if not self:BeenDestroyed() then self:SetImmobile(false) end end)
end
end,

Expand Down

0 comments on commit 7aeb852

Please sign in to comment.