From 331828005244bd9da0f5a0213ecfff9c957c1453 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Fri, 30 Aug 2024 18:21:30 +0200 Subject: Add is `IsValidPlayer()` check (#855) to prevent potential script crash Co-authored-by: Zanieon --- .../mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut index 31c05eb3..1f06ff4a 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut @@ -509,8 +509,11 @@ void function DropFlagIfPhased( entity player, entity flag ) OnThreadEnd( function() : ( player ) { - if (GetGameState() == eGameState.Playing || GetGameState() == eGameState.SuddenDeath) - DropFlag( player, true ) + if ( IsValidPlayer( player ) ) + { + if ( GetGameState() == eGameState.Playing || GetGameState() == eGameState.SuddenDeath ) + DropFlag( player, true ) + } }) // the IsValid check is purely to prevent a crash due to a destroyed flag (epilogue) while( IsValid(flag) && flag.GetParent() == player ) -- cgit v1.2.3