Avoid crash if the team is not set

This commit is contained in:
Bohdan Shulha 2024-08-24 13:04:33 +02:00 committed by GitHub
parent 69fc4c7f52
commit f98805c68b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,8 +89,6 @@ public function uniqueId(): int
public function handle(): void public function handle(): void
{ {
try { try {
BackupCreated::dispatch($this->team->id);
// Check if team is exists // Check if team is exists
if (is_null($this->team)) { if (is_null($this->team)) {
$this->backup->update(['status' => 'failed']); $this->backup->update(['status' => 'failed']);
@ -99,6 +97,9 @@ public function handle(): void
return; return;
} }
BackupCreated::dispatch($this->team->id);
$status = str(data_get($this->database, 'status')); $status = str(data_get($this->database, 'status'));
if (! $status->startsWith('running') && $this->database->id !== 0) { if (! $status->startsWith('running') && $this->database->id !== 0) {
ray('database not running'); ray('database not running');