summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2023-11-16 01:28:42 +0100
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-11-16 17:27:06 +0000
commit07c0223863bff0a1f29a3b5c80b018bc84bd1924 (patch)
tree9531e9451ad90b0c8d907aea26d2a092225436d2 /apps
parent902ba76d3006f915d81f7357e1ac64f3af2d2407 (diff)
downloadnextcloud-server-07c0223863bff0a1f29a3b5c80b018bc84bd1924.tar.gz
nextcloud-server-07c0223863bff0a1f29a3b5c80b018bc84bd1924.zip
Don't call getUid() on null
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_versions/lib/Listener/FileEventsListener.php8
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());
}
}