From 02b369bd50d70896fdcc78125f2d9a0dd321e3c1 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 20 Mar 2024 14:34:59 +0100 Subject: [PATCH] fix: add extra check to ensure wrapped shared storage is set Signed-off-by: Robin Appelman --- apps/files_sharing/lib/SharedStorage.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index ad43e847d37ba..4267331333524 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -545,6 +545,16 @@ public function getSourceStorage() { public function getWrapperStorage() { $this->init(); + + /** + * @psalm-suppress DocblockTypeContradiction + */ + if (!$this->storage) { + $message = "no storage set after init for share " . $this->getShareId(); + $this->logger->error($message); + $this->storage = new FailedStorage(['exception' => new \Exception($message)]); + } + return $this->storage; }