Recently I started face into exception on node save:
The website encountered an unexpected error. Please try again later.
Error: Call to a member function isEmpty() on null in Drupal\office_hours\Plugin\Field\FieldWidget\OfficeHoursWeekWidget->massageFormValues() (line 176 of modules/contrib/office_hours/src/Plugin/Field/FieldWidget/OfficeHoursWeekWidget.php).
Drupal\office_hours\Plugin\Field\FieldWidget\OfficeHoursWeekWidget->massageFormValues() (Line: 400)
Drupal\Core\Field\WidgetBase->extractFormValues() (Line: 237)
Drupal\Core\Entity\Entity\EntityFormDisplay->extractFormValues() (Line: 334)
Drupal\Core\Entity\ContentEntityForm->copyFormValuesToEntity() (Line: 293)
Drupal\Core\Entity\EntityForm->buildEntity() (Line: 155)
Drupal\Core\Entity\ContentEntityForm->buildEntity() (Line: 186)
Drupal\Core\Entity\ContentEntityForm->validateForm()
call_user_func_array() (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
Drupal\Core\Form\FormValidator->validateForm() (Line: 591)
Drupal\Core\Form\FormBuilder->processForm() (Line: 323)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19)
BTW didn't set seasons at all.
My content type has paragraph field.
And this error only occurs when I add or delete paragraph item.
When I edit exists paragraph values - no error.
Issue fork office_hours-3342673
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3342673-error-call-to-isEmpty
changes, plain diff MR !21
Comments
Comment #2
super_romeo commentedComment #4
super_romeo commentedIt is just a workaround.
Comment #5
johnvComment #7
johnvUsing a proper getter function should do the trick.
Thanks.