diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2024-08-30 18:21:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-30 18:21:30 +0200 |
commit | 331828005244bd9da0f5a0213ecfff9c957c1453 (patch) | |
tree | 203252eac74af7a1ffa1d0adb35b3b18e01a2203 /Northstar.CustomServers | |
parent | ebbf9df5134d75c7d46bca0826cfee47090d8215 (diff) | |
download | NorthstarMods-331828005244bd9da0f5a0213ecfff9c957c1453.tar.gz NorthstarMods-331828005244bd9da0f5a0213ecfff9c957c1453.zip |
Add is `IsValidPlayer()` check (#855)v1.27.6-rc2v1.27.6-rc1
to prevent potential script crash
Co-authored-by: Zanieon <william-millennium@hotmail.com>
Diffstat (limited to 'Northstar.CustomServers')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut | 7 |
1 files 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 ) |