When we include a 'webform_entity_select' field (which supports optgroups) we receive the following error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\Core\Entity\EntityRepository::getTranslationFromContext() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /var/www/html/modules/contrib/webform/src/Element/WebformEntityTrait.php on line 63 in Drupal\Core\Entity\EntityRepository->getTranslationFromContext() (line 82 of core/lib/Drupal/Core/Entity/EntityRepository.php).

This seems to be related to the change in #2885715, where a guard was removed before getting the translated version.

Comments

zseguin created an issue. See original summary.

zseguin’s picture

StatusFileSize
new777 bytes

Here's a possible fix for the issue.

jrockowitz’s picture

Status: Active » Needs review
jrockowitz’s picture

StatusFileSize
new770 bytes

Very minor tweak.

Changed if ($option !== NULL) { to if ($option) {

  • jrockowitz committed 6707ded on 8.x-5.x
    Issue #2916934 by zseguin, jrockowitz: Argument 1 passed to Drupal\Core\...
jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.