From c7de0322b0c4243d6a8e95359b68e1c4f0562829 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 1 Jun 2020 21:34:55 +0200 Subject: [PATCH] sanity check for panel render target size --- MLEM.Ui/Elements/Panel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index 32ace95..16d6c7a 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -213,6 +213,8 @@ namespace MLEM.Ui.Elements { // update the render target var targetArea = (Rectangle) this.GetRenderTargetArea(); + if (targetArea.Width <= 0 || targetArea.Height <= 0) + return; if (this.renderTarget == null || targetArea.Width != this.renderTarget.Width || targetArea.Height != this.renderTarget.Height) { if (this.renderTarget != null) this.renderTarget.Dispose();