Fixed crash in MigrationRunner

The crashed was caused by importing the migrationOptions even if the
migrations.xml file is non existant.
[Issue]: ~/.config/jellyfin/migrations.xml not found #6992
This commit is contained in:
Stoica Tedy 2021-12-14 09:31:35 +02:00
parent 0872ede57b
commit 250332104b
No known key found for this signature in database
GPG Key ID: C29A238B2A1A7945

View File

@ -75,6 +75,10 @@ namespace Jellyfin.Server.Migrations
var xmlSerializer = new MyXmlSerializer(); var xmlSerializer = new MyXmlSerializer();
var migrationConfigPath = Path.Join(appPaths.ConfigurationDirectoryPath, MigrationsListStore.StoreKey.ToLowerInvariant() + ".xml"); var migrationConfigPath = Path.Join(appPaths.ConfigurationDirectoryPath, MigrationsListStore.StoreKey.ToLowerInvariant() + ".xml");
if (!File.Exists(migrationConfigPath))
{
return;
}
var migrationOptions = (MigrationOptions)xmlSerializer.DeserializeFromFile(typeof(MigrationOptions), migrationConfigPath)!; var migrationOptions = (MigrationOptions)xmlSerializer.DeserializeFromFile(typeof(MigrationOptions), migrationConfigPath)!;
// We have to deserialize it manually since the configuration manager may overwrite it // We have to deserialize it manually since the configuration manager may overwrite it