Sanity check for imported settings that may have invalid data. (#1426)

This commit is contained in:
Enrico Giordani 2020-03-03 21:45:25 +01:00 committed by GitHub
parent 02c08c942d
commit f3b3e3eded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);