summaryrefslogtreecommitdiffstats
path: root/lib/private/preview.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-01-08 18:33:35 +0100
committerLukas Reschke <lukas@owncloud.com>2015-01-08 18:38:17 +0100
commitceaaab6295ad30e066c9d5505e9131136bafbdb8 (patch)
treea18a83a8878e34400157232ef89487fb8899d3bc /lib/private/preview.php
parentaf269258d3dbcb610dad3bd241464845425d5123 (diff)
downloadnextcloud-server-ceaaab6295ad30e066c9d5505e9131136bafbdb8.tar.gz
nextcloud-server-ceaaab6295ad30e066c9d5505e9131136bafbdb8.zip
Verify whether type is correct
`$this->info` can very well contain an empty array or possibly other values. This means that when this code path is called a PHP Fatal error might get thrown which is not what we want.
Diffstat (limited to 'lib/private/preview.php')
-rw-r--r--lib/private/preview.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/preview.php b/lib/private/preview.php
index a586c94fd11..c7ef00652aa 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -200,14 +200,15 @@ class Preview {
/**
* set the path of the file you want a thumbnail from
* @param string $file
- * @return \OC\Preview $this
+ * @return $this
*/
public function setFile($file) {
$this->file = $file;
$this->info = null;
+
if ($file !== '') {
$this->getFileInfo();
- if($this->info !== null && $this->info !== false) {
+ if($this->info instanceof \OCP\Files\FileInfo) {
$this->mimeType = $this->info->getMimetype();
}
}