aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Miller <william-millennium@hotmail.com>2024-09-02 20:23:10 -0300
committerGitHub <noreply@github.com>2024-09-03 01:23:10 +0200
commit0aa2d0adb1812ed78a9dc3b4452f4ced01bed8f2 (patch)
tree8c30de14e39fb1486b0a728b7ecf1a676d7a0ec6
parentb664005c5dc0142531176258db53a3bf47392faf (diff)
downloadNorthstarMods-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.
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut8
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 90b20a8a6..e52b0de52 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" )