summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-06-08 15:10:29 +0200
committerOlivier Paroz <github@oparoz.com>2015-06-08 15:10:29 +0200
commit3d0a52321791309e06843123a460fd9ad24d89c0 (patch)
tree551659114d0900a06363627f5a036863ad224c75
parent71d65cb713ebfb85ee19f9f3cd17dd915360fe9b (diff)
downloadnextcloud-server-3d0a52321791309e06843123a460fd9ad24d89c0.tar.gz
nextcloud-server-3d0a52321791309e06843123a460fd9ad24d89c0.zip
Make sure we have a resource before measuring its size
-rw-r--r--lib/private/image.php6
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);
}