diff options
author | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2023-11-16 01:28:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 01:28:42 +0100 |
commit | 652317e3e2c69126bf96eb668f1e38849964ccc8 (patch) | |
tree | bf2ecdbf1755b0d3e58c540ee310cd46f8c93b30 /apps/files_versions | |
parent | 8bda5e94609c21abe382a7b3c30669aac958f728 (diff) | |
download | nextcloud-server-652317e3e2c69126bf96eb668f1e38849964ccc8.tar.gz nextcloud-server-652317e3e2c69126bf96eb668f1e38849964ccc8.zip |
Don't call getUid() on null
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/lib/Listener/FileEventsListener.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php index d90283bacc8..323b92b3920 100644 --- a/apps/files_versions/lib/Listener/FileEventsListener.php +++ b/apps/files_versions/lib/Listener/FileEventsListener.php @@ -351,7 +351,7 @@ class FileEventsListener implements IEventListener { /** * Retrieve the path relative to the current user root folder. - * If no user is connected, use the node's owner. + * If no user is connected, try to use the node's owner. */ private function getPathForNode(Node $node): ?string { try { @@ -359,8 +359,12 @@ class FileEventsListener implements IEventListener { ->getUserFolder(\OC_User::getUser()) ->getRelativePath($node->getPath()); } catch (\Throwable $ex) { + $owner = $node->getOwner(); + if ($owner === null) { + return null; + } return $this->rootFolder - ->getUserFolder($node->getOwner()->getUid()) + ->getUserFolder($owner->getUid()) ->getRelativePath($node->getPath()); } } |