diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-08-18 10:35:04 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-08-18 10:35:04 +0200 |
commit | c933848c55377633a8c0fd748d875ef07aa212fb (patch) | |
tree | b51fb94028542d5a326d4578440f47021291a37e | |
parent | 4dd07f572ca726c7e62204170c3fdbf5c6c6cfbd (diff) | |
parent | 303f6da76fbddc31540a129819356a69b7589496 (diff) | |
download | nextcloud-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-x | lib/private/preview.php | 13 |
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)) { |