From 238adabefb4f3b019ec7f92f9787ac7207ab610a Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 12 Apr 2021 12:37:11 +0000 Subject: [PATCH] Catch Imagick errors See https://github.com/friendica/friendica/issues/9747#issuecomment-809675750 --- src/Object/Image.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Object/Image.php b/src/Object/Image.php index 2ae43520e..8592aff91 100644 --- a/src/Object/Image.php +++ b/src/Object/Image.php @@ -230,9 +230,13 @@ class Image } if ($this->isImagick()) { - /* Clean it */ - $this->image = $this->image->deconstructImages(); - return $this->image; + try { + /* Clean it */ + $this->image = $this->image->deconstructImages(); + return $this->image; + } catch (Exception $e) { + return false; + } } return $this->image; } @@ -676,10 +680,14 @@ class Image } if ($this->isImagick()) { - /* Clean it */ - $this->image = $this->image->deconstructImages(); - $string = $this->image->getImagesBlob(); - return $string; + try { + /* Clean it */ + $this->image = $this->image->deconstructImages(); + $string = $this->image->getImagesBlob(); + return $string; + } catch (Exception $e) { + return false; + } } ob_start();