From c2bd2d9a77435678843be5192014a141404d64f8 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Thu, 27 Oct 2022 07:22:46 +1300 Subject: [PATCH] fix: handle case if failover returns null --- src/Extensions/FocusPointDBFileExtension.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Extensions/FocusPointDBFileExtension.php b/src/Extensions/FocusPointDBFileExtension.php index 58a8942..848a974 100644 --- a/src/Extensions/FocusPointDBFileExtension.php +++ b/src/Extensions/FocusPointDBFileExtension.php @@ -27,7 +27,7 @@ public function getFocusPoint(): ?DBFocusPoint // using a non-focuspoint resize mechanism. /** @var ViewableData|FocusPointExtension $failover */ $failover = $this->owner->getFailover(); - if ($failover->hasExtension(FocusPointExtension::class)) { + if ($failover && $failover->hasExtension(FocusPointExtension::class)) { $sourceFocus = $failover->FocusPoint; // Note: Let Width / Height be lazy loaded, so don't generate here @@ -37,7 +37,7 @@ public function getFocusPoint(): ?DBFocusPoint 'Y' => $sourceFocus->getY(), ], $this->owner); - // Save this focu point and return + // Save this focus point and return $this->owner->setFocusPoint($newFocusPoint); return $newFocusPoint; }