diff options
Diffstat (limited to 'lib/private')
-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)) { |