summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2021-02-25 19:14:05 +0000
committersr55 <[email protected]>2021-02-25 19:14:21 +0000
commitf707724396b57923211f162e9c2936cc49f4a3cd (patch)
tree814282ce65ca60956517833f1e23a998b2103316 /win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
parent1fbc0da51f35d3778bfd6329331442c07255ed55 (diff)
WinGui: Make the Windows UI tolerate empty categories #3434
Diffstat (limited to 'win/CS/HandBrakeWPF/Services/Presets/PresetService.cs')
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/PresetService.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
index 11e448c62..e9e36a43b 100644
--- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
+++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
@@ -160,6 +160,11 @@ namespace HandBrakeWPF.Services.Presets
foreach (var objectPreset in container.PresetList)
{
HBPresetCategory category = JsonConvert.DeserializeObject<HBPresetCategory>(objectPreset.ToString());
+ if (category == null || category.ChildrenArray == null || category.ChildrenArray.Count == 0)
+ {
+ continue; // Ignore empty preset categories.
+ }
+
if (category != null && category.ChildrenArray != null && category.ChildrenArray.Count > 0)
{
foreach (HBPreset hbPreset in category.ChildrenArray)