prevent errors with non-objects

This commit is contained in:
Steffen Schröder 2014-07-20 00:24:25 +02:00
parent 861f9217b3
commit e58bd8648b

View File

@ -594,7 +594,6 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
var_dump($responseData); var_dump($responseData);
} }
}, $content, true); }, $content, true);
return;
} }
/** /**
@ -939,13 +938,12 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
* @return bool * @return bool
*/ */
private function insertDedimaniaRecord(RecordData &$newRecord, RecordData $oldRecord) { private function insertDedimaniaRecord(RecordData &$newRecord, RecordData $oldRecord) {
if ($newRecord->nullRecord) { if (!$this->dedimaniaData || !$this->dedimaniaData->records || $newRecord->nullRecord) {
return false; return false;
} }
$insert = false; $insert = false;
var_dump($newRecord);
// Get max possible rank // Get max possible rank
$maxRank = $this->dedimaniaData->getPlayerMaxRank($newRecord->login); $maxRank = $this->dedimaniaData->getPlayerMaxRank($newRecord->login);
@ -1167,10 +1165,10 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
/** /**
* Function to retrieve the dedimania records on the current map * Function to retrieve the dedimania records on the current map
* *
* @return array|RecordData * @return RecordData[]
*/ */
public function getDedimaniaRecords() { public function getDedimaniaRecords() {
if ($this->dedimaniaData->records) { if ($this->dedimaniaData && $this->dedimaniaData->records) {
return $this->dedimaniaData->records; return $this->dedimaniaData->records;
} }
return null; return null;