Skip to content

Commit

Permalink
Fix crash when player is in a special team (R2Northstar#866)
Browse files Browse the repository at this point in the history
on player team switch.

Adds a check whether player is in a default team (IMC/Milita) before calling `GetOtherTeam()`
  • Loading branch information
LightBlueCube authored Sep 9, 2024
1 parent bf5f6b0 commit ee33fd3
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,9 @@ void function OnPlayerChangedTeam( entity player )
if ( !player.hasConnected ) // Prevents players who just joined to trigger below code, as server always pre setups their teams
return

NotifyClientsOfTeamChange( player, GetOtherTeam( player.GetTeam() ), player.GetTeam() )
// only TEAM_IMC and TEAM_MILITIA can use function GetOtherTeam(), doesnt need to notify them when player got a special team
if( IsIMCOrMilitiaTeam( player.GetTeam() ) )
NotifyClientsOfTeamChange( player, GetOtherTeam( player.GetTeam() ), player.GetTeam() )

foreach( npc in GetNPCArray() )
{
Expand Down

0 comments on commit ee33fd3

Please sign in to comment.