summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-08-18 10:35:04 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-08-18 10:35:04 +0200
commitc933848c55377633a8c0fd748d875ef07aa212fb (patch)
treeb51fb94028542d5a326d4578440f47021291a37e
parent4dd07f572ca726c7e62204170c3fdbf5c6c6cfbd (diff)
parent303f6da76fbddc31540a129819356a69b7589496 (diff)
downloadnextcloud-server-c933848c55377633a8c0fd748d875ef07aa212fb.tar.gz
nextcloud-server-c933848c55377633a8c0fd748d875ef07aa212fb.zip
Merge pull request #10156 from owncloud/issue/9968
Check return of fopen() before using it
-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)) {