From 3758eb80477e34f00023b70082c16a2c66df7c44 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 24 May 2017 13:56:09 +0200 Subject: dont die if we try to access the shared cache while setting up the shared storage Signed-off-by: Robin Appelman --- apps/files_sharing/lib/Cache.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'apps/files_sharing') diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index bc10ddbd94f..a55c2a0848d 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -27,6 +27,7 @@ namespace OCA\Files_Sharing; +use OC\Files\Cache\FailedCache; use OC\Files\Cache\Wrapper\CacheJail; use OCP\Files\Cache\ICacheEntry; use OCP\Files\Storage\IStorage; @@ -66,7 +67,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; } -- cgit v1.2.3