Skip to content

Commit

Permalink
Fix error when player disconnect (#1683)
Browse files Browse the repository at this point in the history
* Fix error when player disconnect 

if the frame is open and a player disconnect will error by trying to use a null entity

* Update sfframe.lua
  • Loading branch information
ax255 authored Mar 26, 2024
1 parent 80cb167 commit f7bf401
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/starfall/editor/sfframe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,7 @@ function PANEL:UpdatePlayers(players)
local svtotal = 0
local cltotal = 0
for instance, _ in pairs(SF.playerInstances[ply] or {}) do
svtotal = svtotal + instance.entity:GetNWInt("CPUus")
svtotal = svtotal + (instance.entity:IsValid() and instance.entity:GetNWInt("CPUus") or 0)
cltotal = cltotal + instance.cpu_average
end
cpuServerText:SetText(string.format("SV CPU: %3.1f us", svtotal))
Expand Down

0 comments on commit f7bf401

Please sign in to comment.