From 240f67f15c1259dafa7f78c22858a20ac08d4725 Mon Sep 17 00:00:00 2001 From: Seraphima Zykova Date: Tue, 29 Sep 2020 13:12:21 +0300 Subject: [PATCH] Fixed crash with big 'Space around zones' values (#6815) --- .../fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs index 00a922cdd7..6bd4037b0d 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs @@ -2,6 +2,7 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Generic; using System.Linq; using System.Windows; @@ -171,8 +172,8 @@ namespace FancyZonesEditor maxCol++; } - rect.Width = colInfo[maxCol].End - left; - rect.Height = rowInfo[maxRow].End - top; + rect.Width = Math.Max(0, colInfo[maxCol].End - left); + rect.Height = Math.Max(0, rowInfo[maxRow].End - top); rect.StrokeThickness = 1; rect.Stroke = Brushes.DarkGray; rect.Fill = Brushes.LightGray;