[BUGFIX] Periodically PHP fatal error
authorAlex Kellner <alexander.kellner@in2code.de>
Wed, 14 Oct 2015 08:32:49 +0000 (10:32 +0200)
committerAlex Kellner <alexander.kellner@in2code.de>
Wed, 14 Oct 2015 08:32:49 +0000 (10:32 +0200)
Check if $form is not null

Related: #70096

Classes/Controller/ConditionController.php

index aee90cb..bad714e 100644 (file)
@@ -65,13 +65,15 @@ class ConditionController extends ActionController {
                unset($arguments['__trustedProperties']);
                /** @var Form $form */
                $form = $this->formRepository->findByIdentifier($arguments['mail']['form']);
-               /** @var Page $page */
-               foreach ($form->getPages() as $page) {
-                       /** @var Field $field */
-                       foreach ($page->getFields() as $field) {
-                               foreach ($arguments['field'] as $fieldName => $fieldValue) {
-                                       if ($field->getMarker() === $fieldName) {
-                                               $field->setText($fieldValue);
+               if ($form !== NULL) {
+                       /** @var Page $page */
+                       foreach ($form->getPages() as $page) {
+                               /** @var Field $field */
+                               foreach ($page->getFields() as $field) {
+                                       foreach ($arguments['field'] as $fieldName => $fieldValue) {
+                                               if ($field->getMarker() === $fieldName) {
+                                                       $field->setText($fieldValue);
+                                               }
                                        }
                                }
                        }