null cl lua emitter fix

added a NULL check for invalid cl lua emitters.
This commit is contained in:
Mee12345 2022-02-14 22:46:21 -05:00 committed by GitHub
parent 3aaa06968e
commit e7ef1331bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -559,6 +559,7 @@ function ENT:Draw()
if self.engineRpm > 0.2 and self.SmokePos then
if !self.lastHeatDrawn or self.lastHeatDrawn < CurTime()-0.1 then
if type(self.SmokePos) == "table" then
if !self.Emitter or !self.Emitter:IsValid() then return end -- sometimes it isnt valid for some reason
for _, v in self.SmokePos do
local particle = self.Emitter:Add("sprites/heatwave",self:LocalToWorld(v))
particle:SetVelocity(self:GetVelocity()+self:GetForward()*-100)