From 02814da046717aa1900b8c996f43e14eea740a19 Mon Sep 17 00:00:00 2001 From: andresterc Date: Thu, 14 Sep 2023 13:44:03 +0200 Subject: [PATCH] Fix issue with non existing users If a user doesn't exit you cant edit the mediafile, it gives an error. --- .../mediamanager/model/mediamanager/classes/files.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/components/mediamanager/model/mediamanager/classes/files.class.php b/core/components/mediamanager/model/mediamanager/classes/files.class.php index 9aba1f0..e41ca5b 100644 --- a/core/components/mediamanager/model/mediamanager/classes/files.class.php +++ b/core/components/mediamanager/model/mediamanager/classes/files.class.php @@ -351,8 +351,10 @@ public function getFileHtml($fileId, $template) $versionArr['created_by'] != 0 ) { $user = $this->mediaManager->modx->getObject('modUser', ['id' => $versionArr['created_by']]); - $profile = $user->getOne('Profile'); - $versionArr['created_by'] = $profile->get('fullname'); + if ($user) { + $profile = $user->getOne('Profile'); + $versionArr['created_by'] = $profile->get('fullname'); + } } $fileInformation = pathinfo($versionArr['path']);