From cf6a71129ccd625bf2cc9e92b068f83be8b794e1 Mon Sep 17 00:00:00 2001 From: sukhwinder-somar Date: Mon, 2 Oct 2023 08:48:43 +1300 Subject: [PATCH] return null in loop --- src/Control/ElementFormController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Control/ElementFormController.php b/src/Control/ElementFormController.php index 2f7ca4c..050ce9a 100644 --- a/src/Control/ElementFormController.php +++ b/src/Control/ElementFormController.php @@ -63,6 +63,10 @@ public function finished() while(!$page instanceof SiteTree) { $page = $page->getPage(); + + if ($page === null) { + return null; + } } $controller = Injector::inst()->create($page->getControllerName(), $page->data()); $element = $this->element;