Skip to content

Commit 8ca2748

Browse files
author
Oleksii Korshenko
authored
MAGETWO-70537: Added try-catch block in getSwatchAttributeImage #10181
2 parents 95c5c4a + 8a7d851 commit 8ca2748

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: app/code/Magento/Swatches/Helper/Media.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ public function getSwatchAttributeImage($swatchType, $file)
109109
$absoluteImagePath = $this->mediaDirectory
110110
->getAbsolutePath($this->getSwatchMediaPath() . '/' . $generationPath);
111111
if (!file_exists($absoluteImagePath)) {
112-
$this->generateSwatchVariations($file);
112+
try {
113+
$this->generateSwatchVariations($file);
114+
} catch (\Exception $e) {
115+
return '';
116+
}
113117
}
114118
return $this->getSwatchMediaUrl() . '/' . $generationPath;
115119
}

0 commit comments

Comments
 (0)