From b3d73edbbd1aa2436df5b4f91218f71f049e1538 Mon Sep 17 00:00:00 2001 From: Roman Zipp Date: Mon, 10 Sep 2018 12:28:04 +0200 Subject: [PATCH] Fix null error exception --- src/Models/Monitor.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Models/Monitor.php b/src/Models/Monitor.php index 127358c0..0be06bf4 100644 --- a/src/Models/Monitor.php +++ b/src/Models/Monitor.php @@ -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)); }