handle case where storage can't be created in getStorageRootId

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-06-17 14:32:38 +02:00 committed by MichaIng
parent a7859c5502
commit 4180ca7a0b

View file

@ -269,7 +269,13 @@ class MountPoint implements IMountPoint {
*/
public function getStorageRootId() {
if (is_null($this->rootId) || $this->rootId === -1) {
$this->rootId = (int)$this->getStorage()->getCache()->getId('');
$storage = $this->getStorage();
// if we can't create the storage return -1 as root id, this is then handled the same as if the root isn't scanned yet
if ($storage === null) {
$this->rootId = -1;
} else {
$this->rootId = (int)$storage->getCache()->getId('');
}
}
return $this->rootId;
}