From 6e3892fcf92add2f461673a25f288f66c0944d6e Mon Sep 17 00:00:00 2001 From: thegrb93 Date: Sat, 16 Mar 2024 18:44:30 -0400 Subject: [PATCH] Make error func only able to run on chip if it has instance (#1670) --- lua/entities/starfall_processor/shared.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/entities/starfall_processor/shared.lua b/lua/entities/starfall_processor/shared.lua index 0a284da08..ecf033591 100644 --- a/lua/entities/starfall_processor/shared.lua +++ b/lua/entities/starfall_processor/shared.lua @@ -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 @@ -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)