diff options
author | William Miller <william-millennium@hotmail.com> | 2024-09-02 20:23:10 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-03 01:23:10 +0200 |
commit | 0aa2d0adb1812ed78a9dc3b4452f4ced01bed8f2 (patch) | |
tree | 8c30de14e39fb1486b0a728b7ecf1a676d7a0ec6 /Northstar.CustomServers/mod | |
parent | b664005c5dc0142531176258db53a3bf47392faf (diff) | |
download | NorthstarMods-0aa2d0adb1812ed78a9dc3b4452f4ced01bed8f2.tar.gz NorthstarMods-0aa2d0adb1812ed78a9dc3b4452f4ced01bed8f2.zip |
Add `IsValidPlayer()` before flag return cleanup (#859)
Add validity check to player validity as the thread of that function might end on via OnDestroy signal by disconnection, and by that point, the player is no longer valid.
Diffstat (limited to 'Northstar.CustomServers/mod')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut index 90b20a8a..e52b0de5 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut @@ -453,9 +453,11 @@ void function TryReturnFlag( entity player, entity flag ) OnThreadEnd( function() : ( player ) { - // cleanup - Remote_CallFunction_NonReplay( player, "ServerCallback_CTF_StopReturnFlagProgressBar" ) - StopSoundOnEntity( player, "UI_CTF_1P_FlagReturnMeter" ) + if ( IsValidPlayer( player ) ) + { + Remote_CallFunction_NonReplay( player, "ServerCallback_CTF_StopReturnFlagProgressBar" ) + StopSoundOnEntity( player, "UI_CTF_1P_FlagReturnMeter" ) + } }) player.EndSignal( "FlagReturnEnded" ) |