Merge pull request #10156 from owncloud/issue/9968

Check return of fopen() before using it
This commit is contained in:
Thomas Müller 2014-08-18 10:35:04 +02:00
commit c933848c55
1 changed files with 8 additions and 5 deletions

View File

@ -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)) {