Skip to content

Commit

Permalink
Fix null error exception
Browse files Browse the repository at this point in the history
  • Loading branch information
romanzipp committed Sep 10, 2018
1 parent 1709720 commit b3d73ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Models/Monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ public function getRemainingSecondsAttribute(): ?float
return null;
}

$secondsRunning = now()->getTimestamp() - $this->created_at->getTimestamp();
if (!$this->started_at) {
return null;
}

$secondsRunning = now()->getTimestamp() - $this->started_at->getTimestamp();

return (float) ($secondsRunning - ($secondsRunning * $this->progress / 100));
}
Expand Down

0 comments on commit b3d73ed

Please sign in to comment.