diff --git a/lib/filecache.php b/lib/filecache.php
index 68f1aa8fe6ba333a76c0cbb5ff7e991e747df473..a0ad2be4f770f595819e33b9d9665dd92445cfa8 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -267,7 +267,7 @@ class OC_FileCache{
 		}
 		$path=$root.$path;
 		$parent=self::getFileId($path);
-		if($path==-1){
+		if($parent==-1){
 			return array();
 		}
     $query=OC_DB::prepare('SELECT name,ctime,mtime,mimetype,size,encrypted,versioned,writable FROM *PREFIX*fscache WHERE parent=? AND (mimetype LIKE ? OR mimetype = ?)');