small callback stability improvement

This commit is contained in:
kremsy
2017-05-09 19:11:19 +02:00
parent 05f688b99f
commit 37e12ebf88
2 changed files with 29 additions and 24 deletions

View File

@ -30,15 +30,18 @@ class OnScoresStructure extends CommonScoresStructure {
$jsonObj = $this->getPlainJsonObject();
foreach ($jsonObj->players as $jsonPlayer) {
$playerScore = new PlayerScore();
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
$playerScore->setRank($jsonPlayer->rank);
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
$playerScore->setMapPoints($jsonPlayer->mappoints);
$playerScore->setMatchPoints($jsonPlayer->matchpoints);
$player = $this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login);
if($player){
$playerScore = new PlayerScore();
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
$this->playerScores[$jsonPlayer->login] = $playerScore;
$playerScore->setRank($jsonPlayer->rank);
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
$playerScore->setMapPoints($jsonPlayer->mappoints);
$playerScore->setMatchPoints($jsonPlayer->matchpoints);
$this->playerScores[$jsonPlayer->login] = $playerScore;
}
}
}
}