fix possible live ranking crash
This commit is contained in:
parent
fba93075b0
commit
a3f042e7f7
@ -1331,7 +1331,8 @@ Void UpdateRanking() {
|
||||
} else {
|
||||
declare Ident PlayerId = ScoreIdToPlayerId.get(Score.Id, NullId);
|
||||
if (PlayerId != NullId) {
|
||||
declare CSmPlayer Player <=> Players[PlayerId];
|
||||
declare CSmPlayer Player <=> Players.get(PlayerId, Null);
|
||||
if (Player != Null) {
|
||||
PlayerState.CPNb = Player.RaceWaypointTimes.count;
|
||||
PlayerState.IsNotPlaying = (Player.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned);
|
||||
PlayerState.Finished = (Score.PrevRaceTimes.count != 0);
|
||||
@ -1342,6 +1343,7 @@ Void UpdateRanking() {
|
||||
if (GlobalLastCPTime < PlayerState.LastCPTime) GlobalLastCPTime = PlayerState.LastCPTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Ranking.existskey(PlayerState.CPNb)) Ranking[PlayerState.CPNb] = [];
|
||||
if (!Ranking[PlayerState.CPNb].existskey(PlayerState.LastCPTime)) Ranking[PlayerState.CPNb][PlayerState.LastCPTime] = [];
|
||||
@ -1392,7 +1394,10 @@ Void UpdateRanking() {
|
||||
PlayerState.InDanger = (Rank >= LostOfLifeRank);
|
||||
|
||||
if (FirstPlayer == Null) {
|
||||
FirstPlayer <=> Players[ScoreIdToPlayerId.get(PlayerState.ScoreId, NullId)];
|
||||
declare Ident FirstPlayerId = ScoreIdToPlayerId.get(PlayerState.ScoreId, NullId);
|
||||
if (FirstPlayerId != NullId) {
|
||||
FirstPlayer <=> Players[FirstPlayerId];
|
||||
}
|
||||
}
|
||||
|
||||
if (FirstPlayer != Null) {
|
||||
|
Loading…
Reference in New Issue
Block a user