The Free Software Media System - Server Backend & API
Skip empty ViewType validation
theguymadmax613d72fa2637
diff --git a/Jellyfin.Api/Controllers/DisplayPreferencesController.cs b/Jellyfin.Api/Controllers/DisplayPreferencesController.csindex 585318d245..ef54e9db54 100644--- a/Jellyfin.Api/Controllers/DisplayPreferencesController.cs+++ b/Jellyfin.Api/Controllers/DisplayPreferencesController.cs@@ -191,9 +191,17 @@ public class DisplayPreferencesController : BaseJellyfinApiControllerforeach (var key in displayPreferences.CustomPrefs.Keys.Where(key => key.StartsWith("landing-", StringComparison.OrdinalIgnoreCase))){- if (!Enum.TryParse<ViewType>(displayPreferences.CustomPrefs[key], true, out _))+ var viewType = displayPreferences.CustomPrefs[key];++ if (string.IsNullOrEmpty(viewType))+ {+ displayPreferences.CustomPrefs.Remove(key);+ continue;+ }++ if (!Enum.TryParse<ViewType>(viewType, true, out _)){- _logger.LogError("Invalid ViewType: {LandingScreenOption}", displayPreferences.CustomPrefs[key]);+ _logger.LogError("Invalid ViewType: {LandingScreenOption}", viewType);displayPreferences.CustomPrefs.Remove(key);}}