Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / file / src / Plugin / Validation / Constraint / FileValidationConstraintValidator.php
index 972aa69767ddc23fb2c757105e344432bea45166..a6da920c669762428b29ae828301d320e7f153c3 100644 (file)
@@ -15,7 +15,12 @@ class FileValidationConstraintValidator extends ConstraintValidator {
    */
   public function validate($value, Constraint $constraint) {
     // Get the file to execute validators.
-    $file = $value->get('entity')->getTarget()->getValue();
+    $target = $value->get('entity')->getTarget();
+    if (!$target) {
+      return;
+    }
+
+    $file = $target->getValue();
     // Get the validators.
     $validators = $value->getUploadValidators();
     // Checks that a file meets the criteria specified by the validators.