From f707724396b57923211f162e9c2936cc49f4a3cd Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 25 Feb 2021 19:14:05 +0000 Subject: WinGui: Make the Windows UI tolerate empty categories #3434 --- win/CS/HandBrakeWPF/Services/Presets/PresetService.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'win') 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(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) -- cgit v1.2.3