summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-08-04 17:53:06 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-08-04 17:53:06 +0200
commit303f6da76fbddc31540a129819356a69b7589496 (patch)
treecf5342ab380759173c466e5bf5d07c8698148d95 /lib
parentf4c7e3c1e9b108f105b8b8a8901d29ec1fe475b4 (diff)
downloadnextcloud-server-303f6da76fbddc31540a129819356a69b7589496.tar.gz
nextcloud-server-303f6da76fbddc31540a129819356a69b7589496.zip
Check return of fopen() before using it
Fix #9968
Diffstat (limited to 'lib')
-rwxr-xr-xlib/private/preview.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/private/preview.php b/lib/private/preview.php
index aeb9806904a..cc15ab84fe7 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -477,12 +477,15 @@ class Preview {
$cached = $this->isCached($fileId);
if ($cached) {
$stream = $this->userView->fopen($cached, 'r');
- $image = new \OC_Image();
- $image->loadFromFileHandle($stream);
- $this->preview = $image->valid() ? $image : null;
+ $this->preview = null;
+ if ($stream) {
+ $image = new \OC_Image();
+ $image->loadFromFileHandle($stream);
+ $this->preview = $image->valid() ? $image : null;
- $this->resizeAndCrop();
- fclose($stream);
+ $this->resizeAndCrop();
+ fclose($stream);
+ }
}
if (is_null($this->preview)) {