avoid crash on player null

This commit is contained in:
kremsy 2014-01-02 18:48:27 +01:00
parent fecda9b84f
commit 7cc7d209d2

View File

@ -126,9 +126,13 @@ class StatisticManager {
* @param string $statType * @param string $statType
* @return bool * @return bool
*/ */
public function insertStat($statName, Player $player, $serverLogin = '', $value, $statType = self::STAT_TYPE_INT) { public function insertStat($statName, $player, $serverLogin = '', $value, $statType = self::STAT_TYPE_INT) {
$statId = $this->getStatId($statName); $statId = $this->getStatId($statName);
if($player == null) {
return false;
}
if($statId == null) { if($statId == null) {
return false; return false;
} }
@ -180,7 +184,7 @@ class StatisticManager {
* @internal param \ManiaControl\Players\Player $playerId * @internal param \ManiaControl\Players\Player $playerId
* @return bool * @return bool
*/ */
public function incrementStat($statName, Player $player, $serverLogin = '') { public function incrementStat($statName, $player, $serverLogin = '') {
return $this->insertStat($statName, $player, $serverLogin, 1); return $this->insertStat($statName, $player, $serverLogin, 1);
} }