From f3b3e3eded2ccffa431cbe03c1c75f449b3fd0cb Mon Sep 17 00:00:00 2001 From: Enrico Giordani Date: Tue, 3 Mar 2020 21:45:25 +0100 Subject: [PATCH] Sanity check for imported settings that may have invalid data. (#1426) --- .../fancyzones/editor/FancyZonesEditor/Models/Settings.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs index 409792d2d9..64c49be11e 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs @@ -258,6 +258,12 @@ namespace FancyZonesEditor // Update the "Focus" Default Layout _focusModel.Zones.Clear(); + // Sanity check for imported settings that may have invalid data + if (ZoneCount < 1) + { + ZoneCount = 3; + } + Int32Rect focusZoneRect = new Int32Rect((int)(_focusModel.ReferenceWidth * 0.1), (int)(_focusModel.ReferenceHeight * 0.1), (int)(_focusModel.ReferenceWidth * 0.6), (int)(_focusModel.ReferenceHeight * 0.6)); int focusRectXIncrement = (ZoneCount <= 1) ? 0 : (int)(_focusModel.ReferenceWidth * 0.2) / (ZoneCount - 1); int focusRectYIncrement = (ZoneCount <= 1) ? 0 : (int)(_focusModel.ReferenceHeight * 0.2) / (ZoneCount - 1);