]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check if version entity is not null before delete 38125/head
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>
Mon, 8 May 2023 12:24:58 +0000 (14:24 +0200)
committerGitHub <noreply@github.com>
Mon, 8 May 2023 12:24:58 +0000 (14:24 +0200)
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
apps/files_versions/lib/Storage.php

index 9141e6c4c652dee33e42bcb73b55990b5caa21f3..cd13e74e786321edbd9d68241b6f896cec2d4bfa 100644 (file)
@@ -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]);
                }