Merge pull request #38224 from nextcloud/versionEntityisSet

Check if version has entity before trying to access it
This commit is contained in:
Louis 2023-05-15 11:26:27 +02:00 committed by GitHub
commit 2f467d936c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -609,7 +609,7 @@ class Storage {
$internalPath = $version->getInternalPath();
\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $internalPath, 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
$versionEntity = $versionEntities[$version->getId()];
$versionEntity = isset($versionEntities[$version->getId()]) ? $versionEntities[$version->getId()] : null;
if (!is_null($versionEntity)) {
$versionsMapper->delete($versionEntity);
}