diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php index b1bab9a..0e17c25 100644 --- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php @@ -65,7 +65,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form $element['#default_value'] = array($element['#default_value']); } - if (!(reset($element['#default_value']) instanceof EntityInterface)) { + if ($element['#default_value'] && !(reset($element['#default_value']) instanceof EntityInterface)) { throw new \InvalidArgumentException('The #default_value property has to be an entity object or an array of entity objects.'); }