diff --git a/lib/Versions/VersionsBackend.php b/lib/Versions/VersionsBackend.php index 1de84094e..0628fa06f 100644 --- a/lib/Versions/VersionsBackend.php +++ b/lib/Versions/VersionsBackend.php @@ -23,6 +23,7 @@ namespace OCA\GroupFolders\Versions; +use OC\User\NoUserException; use OCA\Files_Versions\Versions\IDeletableVersionBackend; use OCA\Files_Versions\Versions\INameableVersionBackend; use OCA\Files_Versions\Versions\INeedSyncVersionBackend; @@ -70,7 +71,11 @@ public function getVersionsForFile(IUser $user, FileInfo $file): array { /** @var Folder $versionsFolder */ $versionsFolder = $this->getVersionsFolder($mount->getFolderId())->get((string)$file->getId()); - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + try { + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + } catch (NoUserException $e) { + return []; + } $nodes = $userFolder->getById($file->getId()); $node = array_pop($nodes); @@ -127,7 +132,12 @@ public function getVersionsForFile(IUser $user, FileInfo $file): array { * @return IVersion[] */ private function getVersionsForFileFromDB(FileInfo $file, IUser $user, int $folderId): array { - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + try { + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + } catch (NoUserException $e) { + return []; + } + /** @var Folder $versionsFolder */ $versionsFolder = $this->getVersionsFolder($folderId)->get((string)$file->getId());