From c69c14a0c6d0c3ef4795e9c0ba83c404bc72afec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sun, 15 Jun 2014 00:05:43 +0200 Subject: [PATCH] prevent error through non-object --- application/plugins/MCTeam/ServerRankingPlugin.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/application/plugins/MCTeam/ServerRankingPlugin.php b/application/plugins/MCTeam/ServerRankingPlugin.php index 03a684df..b40cfacd 100644 --- a/application/plugins/MCTeam/ServerRankingPlugin.php +++ b/application/plugins/MCTeam/ServerRankingPlugin.php @@ -11,7 +11,6 @@ use ManiaControl\Callbacks\Callbacks; use ManiaControl\Commands\CommandListener; use ManiaControl\ManiaControl; use ManiaControl\Manialinks\ManialinkManager; -use ManiaControl\Maps\Map; use ManiaControl\Players\Player; use ManiaControl\Players\PlayerManager; use ManiaControl\Plugins\Plugin; @@ -402,10 +401,13 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { * @return Rank */ private function getNextRank(Player $player) { - $mysqli = $this->maniaControl->database->mysqli; $rankObject = $this->getRank($player); - $nextRank = $rankObject->rank - 1; + if (!$rankObject) { + return null; + } + $nextRank = $rankObject->rank - 1; + $mysqli = $this->maniaControl->database->mysqli; $query = "SELECT * FROM `" . self::TABLE_RANK . "` WHERE `Rank` = {$nextRank}"; $result = $mysqli->query($query); @@ -424,11 +426,9 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { } /** - * Shows Ranks on endMap - * - * @param Map $map + * Show Ranks on Map End */ - public function handleEndMap(Map $map) { + public function handleEndMap() { $this->resetRanks(); foreach ($this->maniaControl->playerManager->getPlayers() as $player) {