Browse Source

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
Stoica Tedy 3 years ago
parent
commit
250332104b
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Jellyfin.Server/Migrations/MigrationRunner.cs

+ 4 - 0
Jellyfin.Server/Migrations/MigrationRunner.cs

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