Skip to content

Commit

Permalink
Fixes #46 - detects if no backups have been returned and escapes.
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonius committed Mar 15, 2020
1 parent 06c7005 commit 88fea0c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Commands/DbBackupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,14 @@ public function dbBackupDownload(
if (!$opts['backup']) {
$client->addQuery('sort', '-created');
$client->addQuery('limit', 1);
$backup = $databaseBackupsAdapter->getAll($environment->uuid, $dbName);
$backups = $databaseBackupsAdapter->getAll($environment->uuid, $dbName);
$client->clearQuery();
if (empty($backup)) {

if (!$backups->count()) {
throw new \Exception('Unable to find a database backup to download.');
}
$backupId = $backup[0]->id;

$backupId = $backups[0]->id;
} else {
$backupId = $opts['backup'];
}
Expand Down

0 comments on commit 88fea0c

Please sign in to comment.