Skip to content

Commit

Permalink
Check if Entity is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
creator2013 committed Feb 22, 2025
1 parent f621d6e commit 45f515b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/autorun/photon/sh_photon_vehicles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Photon:EntityCreated( ent )
timer.Stop( timerId )
timer.Destroy( timerId )
end
if timer.RepsLeft( timerId ) == 0 and CLIENT then
if timer.RepsLeft( timerId ) == 0 and IsValid( ent ) and CLIENT then
local class = ent:GetVehicleClass()
local lst = list.Get("Vehicles")[class]
if lst and istable(lst) then
Expand All @@ -49,7 +49,7 @@ function Photon:EntityCreated( ent )
timer.Destroy( timerId )
end
end
if timer.RepsLeft( timerId ) == 0 and SERVER then
if timer.RepsLeft( timerId ) == 0 and IsValid( ent ) and SERVER then
local default = Photon:RecoverVehicleTable( ent )
if default then
ent.VehicleTable = default
Expand Down

0 comments on commit 45f515b

Please sign in to comment.