]> source.dussan.org Git - nextcloud-server.git/commitdiff
dont die if we try to access the shared cache while setting up the shared storage 5463/head
authorRobin Appelman <robin@icewind.nl>
Wed, 24 May 2017 11:56:09 +0000 (13:56 +0200)
committerRobin Appelman <robin@icewind.nl>
Mon, 19 Jun 2017 12:00:52 +0000 (14:00 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/Cache.php

index d9cf5d80b8036e7ca77196f77305f97d5cc92da4..1c311935bb64283b2dda31d56c163c08c0bcd0ea 100644 (file)
@@ -27,6 +27,7 @@
 
 namespace OCA\Files_Sharing;
 
+use OC\Files\Cache\FailedCache;
 use OC\Files\Cache\Wrapper\CacheJail;
 use OCP\Files\Cache\ICacheEntry;
 
@@ -68,7 +69,13 @@ class Cache extends CacheJail {
 
        public function getCache() {
                if (is_null($this->cache)) {
-                       $this->cache = $this->storage->getSourceStorage()->getCache();
+                       $sourceStorage = $this->storage->getSourceStorage();
+                       if ($sourceStorage) {
+                               $this->cache = $sourceStorage->getCache();
+                       } else {
+                               // don't set $this->cache here since sourceStorage will be set later
+                               return new FailedCache();
+                       }
                }
                return $this->cache;
        }