From 04d89b38b2a08235a6782edcd74ea3d732fc8714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 9 Oct 2022 20:52:52 +0200 Subject: [PATCH] Allow null value during decoding of datetimes when time traveling This should fix some exceptions occuring when viewing historic states of a part. --- src/Services/LogSystem/TimeTravel.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Services/LogSystem/TimeTravel.php b/src/Services/LogSystem/TimeTravel.php index f364c8d9..f574d522 100644 --- a/src/Services/LogSystem/TimeTravel.php +++ b/src/Services/LogSystem/TimeTravel.php @@ -178,8 +178,13 @@ class TimeTravel * @return DateTime * @throws Exception */ - private function dateTimeDecode(array $input): \DateTime + private function dateTimeDecode(?array $input): ?\DateTime { + //Allow null values + if ($input === null) { + return null; + } + return new \DateTime($input['date'], new \DateTimeZone($input['timezone'])); }