Skip to content
Snippets Groups Projects
Commit cc5d8e56 authored by Michael Gapczynski's avatar Michael Gapczynski
Browse files

Check if data variable in scanner isn't null before using it

parent 709aacfa
Branches
No related tags found
No related merge requests found
...@@ -70,6 +70,7 @@ class Scanner { ...@@ -70,6 +70,7 @@ class Scanner {
public function scanFile($file) { public function scanFile($file) {
\OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId)); \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId));
$data = $this->getData($file); $data = $this->getData($file);
if ($data) {
if ($file !== '') { if ($file !== '') {
$parent = dirname($file); $parent = dirname($file);
if ($parent === '.') { if ($parent === '.') {
...@@ -81,6 +82,7 @@ class Scanner { ...@@ -81,6 +82,7 @@ class Scanner {
} }
$id = $this->cache->put($file, $data); $id = $this->cache->put($file, $data);
$this->permissionsCache->set($id, \OC_User::getUser(), $data['permissions']); $this->permissionsCache->set($id, \OC_User::getUser(), $data['permissions']);
}
return $data; return $data;
} }
...@@ -101,6 +103,7 @@ class Scanner { ...@@ -101,6 +103,7 @@ class Scanner {
if ($file !== '.' and $file !== '..') { if ($file !== '.' and $file !== '..') {
$child = ($path !== '') ? $path . '/' . $file : $file; $child = ($path !== '') ? $path . '/' . $file : $file;
$data = $this->scanFile($child); $data = $this->scanFile($child);
if ($data) {
if ($data['mimetype'] === 'httpd/unix-directory') { if ($data['mimetype'] === 'httpd/unix-directory') {
if ($recursive === self::SCAN_RECURSIVE) { if ($recursive === self::SCAN_RECURSIVE) {
$data['size'] = $this->scan($child, self::SCAN_RECURSIVE); $data['size'] = $this->scan($child, self::SCAN_RECURSIVE);
...@@ -115,6 +118,7 @@ class Scanner { ...@@ -115,6 +118,7 @@ class Scanner {
} }
} }
} }
}
if ($size !== -1) { if ($size !== -1) {
$this->cache->put($path, array('size' => $size)); $this->cache->put($path, array('size' => $size));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment