prevent error on missing record id
This commit is contained in:
parent
c69c14a0c6
commit
fa14d96111
@ -631,13 +631,13 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$chatCommand = explode(' ', $chat[1][2]);
|
$commandParts = explode(' ', $chat[1][2]);
|
||||||
$recordId = (int)$chatCommand[1];
|
if (count($commandParts) < 2) {
|
||||||
if ($recordId <= 0) {
|
$this->maniaControl->chat->sendUsageInfo('Missing Record ID! (Example: //delrec 3)', $player);
|
||||||
$this->maniaControl->chat->sendError('No Record ID given!', $player);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$recordId = (int)$commandParts[1];
|
||||||
$currentMap = $this->maniaControl->mapManager->getCurrentMap();
|
$currentMap = $this->maniaControl->mapManager->getCurrentMap();
|
||||||
$records = $this->getLocalRecords($currentMap);
|
$records = $this->getLocalRecords($currentMap);
|
||||||
if (count($records) < $recordId) {
|
if (count($records) < $recordId) {
|
||||||
@ -646,7 +646,9 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
$query = "DELETE FROM `" . self::TABLE_RECORDS . "` WHERE `mapIndex` = {$currentMap->index} AND `playerIndex` = {$player->index};";
|
$query = "DELETE FROM `" . self::TABLE_RECORDS . "`
|
||||||
|
WHERE `mapIndex` = {$currentMap->index}
|
||||||
|
AND `playerIndex` = {$player->index};";
|
||||||
$mysqli->query($query);
|
$mysqli->query($query);
|
||||||
if ($mysqli->error) {
|
if ($mysqli->error) {
|
||||||
trigger_error($mysqli->error);
|
trigger_error($mysqli->error);
|
||||||
|
Loading…
Reference in New Issue
Block a user