diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php
index b1579f2445..4e78d89486 100644
--- a/core/lib/Drupal/Core/Field/WidgetBase.php
+++ b/core/lib/Drupal/Core/Field/WidgetBase.php
@@ -435,7 +435,7 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
           foreach ($delta_violations as $violation) {
             // @todo: Pass $violation->arrayPropertyPath as property path.
             $error_element = $this->errorElement($delta_element, $violation, $form, $form_state);
-            if ($error_element !== FALSE) {
+            if (is_array($error_element)) {
               $form_state->setError($error_element, $violation->getMessage());
             }
           }
