summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
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());
}
}