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

index cde7c4dec1fcd8f7af0bab883e4700fce54b6eb1..3a925cfbd8b22a1e3162099f29057cb410218a22 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]);
                }