From 7cd5cbe6e9e7d79039f89034b90a13c3aa0b9278 Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Mon, 8 May 2023 14:24:58 +0200 Subject: Check if version entity is not null before delete Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- apps/files_versions/lib/Storage.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 9141e6c4c65..cd13e74e786 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -608,7 +608,12 @@ class Storage { foreach ($versions as $version) { $internalPath = $version->getInternalPath(); \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $internalPath, 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]); - $versionsMapper->delete($versionEntities[$version->getId()]); + + $versionEntity = $versionEntities[$version->getId()]; + if (!is_null($versionEntity)) { + $versionsMapper->delete($versionEntity); + } + $version->delete(); \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $internalPath, 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]); } -- cgit v1.2.3