diff options
-rw-r--r-- | lib/private/image.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/image.php b/lib/private/image.php index 54e5ef7cad5..fad0b53cb49 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -982,10 +982,14 @@ class OC_Image implements \OCP\IImage { * @return bool */ public function scaleDownToFit($maxWidth, $maxHeight) { + if (!$this->valid()) { + $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core')); + return false; + } $widthOrig = imageSX($this->resource); $heightOrig = imageSY($this->resource); - if ($widthOrig > $maxWidth || $heightOrig >$maxHeight) { + if ($widthOrig > $maxWidth || $heightOrig > $maxHeight) { return $this->fitIn($maxWidth, $maxHeight); } |