diff options
author | Olivier Paroz <github@oparoz.com> | 2015-06-08 15:10:29 +0200 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-06-08 15:10:29 +0200 |
commit | 3d0a52321791309e06843123a460fd9ad24d89c0 (patch) | |
tree | 551659114d0900a06363627f5a036863ad224c75 | |
parent | 71d65cb713ebfb85ee19f9f3cd17dd915360fe9b (diff) | |
download | nextcloud-server-3d0a52321791309e06843123a460fd9ad24d89c0.tar.gz nextcloud-server-3d0a52321791309e06843123a460fd9ad24d89c0.zip |
Make sure we have a resource before measuring its size
-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); } |