Attempt to compare nil with number

I am making it so that when looking at a prop, it waits about a second before showing who owns it. It works as expected, except when I look at the prop as soon as it was created. I’m not sure how to get around this.

This is where I check & draw the text

[lua]local _EyeTrace = LocalPlayer():GetEyeTrace()
if (IsValid(_EyeTrace.Entity) && !_EyeTrace.Entity:IsWorld() && _EyeTrace.Entity:GetClass() == “prop_physics”) then
if _EyeTrace.Entity != lastEntity then
lastEntity = _EyeTrace.Entity
lastEntity.OwnerText = _EyeTrace.Entity:GetNetworkedEntity(“Owner”):GetName()
lastEntity.CanDraw = false
lastEntity.ShowTime = CurTime() + 1
end
if lastEntity.CanDraw then
draw.DrawText(lastEntity.OwnerText, “TargetID”, ScrW() / 2, ScrH() / 2, Color(255, 255, 255), TEXT_ALIGN_CENTER)
else
if CurTime() >= lastEntity.ShowTime then
lastEntity.CanDraw = true
end
end
end[/lua]

This is where I spawn the prop on the server

[lua]function SpawnProp( ply, com, arg )
prop = ents.Create(“prop_physics”)
prop:SetNetworkedEntity(“Owner”, ply)
prop:SetModel(arg[1])
prop:SetPos(ply:GetEyeTrace().HitPos + Vector(0, 0, 50))
prop:Spawn()
undo.Create(“prop”)
undo.AddEntity(prop)
undo.SetPlayer(ply)
undo.Finish()
end[/lua]

Any ideas?

And which line is 272?

To get around it easy just check if lastEntity.ShowTime is defined.
[lua]if lastEntity.ShowTime and CurTime() >= lastEntity.ShowTime then[/lua]

Thanks guys. I did fix it before Thermadyle posted though, I simply delayed the prop spawning by about half a second and that did the trick. This will also stop people from attempting to prop spam