From 839b2cfebc8334fda282093e2ba479a39afabb11 Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 10 Jun 2021 20:29:05 +0100 Subject: [PATCH] Fixes negative Width and Height exception. --- Terminal.Gui/Views/FrameView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Terminal.Gui/Views/FrameView.cs b/Terminal.Gui/Views/FrameView.cs index e1be1dc09..be992ba1c 100644 --- a/Terminal.Gui/Views/FrameView.cs +++ b/Terminal.Gui/Views/FrameView.cs @@ -9,6 +9,7 @@ // - Does not support IEnumerable // Any udpates done here should probably be done in Window as well; TODO: Merge these classes +using System; using System.Linq; using NStack; @@ -50,7 +51,7 @@ namespace Terminal.Gui { /// Title. public FrameView (Rect frame, ustring title = null) : base (frame) { - var cFrame = new Rect (1, 1, frame.Width - 2, frame.Height - 2); + var cFrame = new Rect (1, 1, Math.Max (frame.Width - 2, 0), Math.Max (frame.Height - 2, 0)); this.title = title; contentView = new ContentView (cFrame); Initialize ();