diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 8d0681ba9351aa7b2ad9e53b1ee072d2099b8a39..8831320bcee0bc4b2190d4ad508651b127b19b58 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -588,7 +588,7 @@ class Cache {
 		if (is_null($entry) or !isset($entry['fileid'])) {
 			$entry = $this->get($path);
 		}
-		if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
+		if (isset($entry['mimetype']) && $entry['mimetype'] === 'httpd/unix-directory') {
 			$id = $entry['fileid'];
 			$sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2, ' .
 				'SUM(`unencrypted_size`) AS f3 ' .