[BUGFIX] Prevent exception in ImageCropUpdater 20/53120/2
authorNicole Cordes <typo3@cordes.co>
Mon, 5 Jun 2017 12:18:51 +0000 (14:18 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 5 Jun 2017 14:13:20 +0000 (16:13 +0200)
The ImageCropUpdater throws an exception if a non-existing file is tried
to be processed. This happens because deleted rows are updated. The patch
checks the returned file object before further processing is executed.

Resolves: #81470
Releases: master, 8.7
Change-Id: I488994b1ad842e28d928f3b4a2db1c8c007afe3c
Reviewed-on: https://review.typo3.org/53120
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/install/Classes/Updates/RowUpdater/ImageCropUpdater.php

index 1d99eed..8107a7c 100644 (file)
@@ -76,9 +76,13 @@ class ImageCropUpdater implements RowUpdaterInterface
 
         foreach ($tablePayload['fields'] as $field) {
             if (strpos($inputRow[$field], '{"x":') === 0) {
-                $file = $this->getFile($inputRow, $tablePayload['fileReferenceField'] ?: 'uid_local');
                 $cropArray = json_decode($inputRow[$field], true);
                 if (is_array($cropArray)) {
+                    $file = $this->getFile($inputRow, $tablePayload['fileReferenceField'] ?: 'uid_local');
+                    if (null === $file) {
+                        continue;
+                    }
+
                     $cropArea = Area::createFromConfiguration(json_decode($inputRow[$field], true));
                     $cropVariantCollectionConfig = [
                         'default' => [