Skip to content

Commit

Permalink
Make error func only able to run on chip if it has instance (#1670)
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrb93 authored Mar 16, 2024
1 parent fa4b4ed commit 6e3892f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lua/entities/starfall_processor/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function ENT:GetGateName()
end

function ENT:Error(err)
if not self.instance then return end
self.error = err

local msg = err.message
Expand All @@ -140,10 +141,8 @@ function ENT:Error(err)
hook.Run("StarfallError", self, self.owner, CLIENT and LocalPlayer() or false, self.sfdata.mainfile, msg, traceback)
SF.SendError(self, msg, traceback)

if self.instance then
self.instance:deinitialize()
self.instance = nil
end
self.instance:deinitialize()
self.instance = nil

for inst, _ in pairs(SF.allInstances) do
inst:runScriptHook("starfallerror", inst.Types.Entity.Wrap(self), inst.Types.Player.Wrap(SERVER and self.owner or LocalPlayer()), msg)
Expand Down

0 comments on commit 6e3892f

Please sign in to comment.