From d224d57cf2e4d677b673b317b3cc83d83f51d1c6 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 1 Dec 2019 22:58:20 +0100 Subject: [PATCH] added a handler for this --- MLEM/Extensions/GraphicsExtensions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MLEM/Extensions/GraphicsExtensions.cs b/MLEM/Extensions/GraphicsExtensions.cs index df5faa1..a84e01a 100644 --- a/MLEM/Extensions/GraphicsExtensions.cs +++ b/MLEM/Extensions/GraphicsExtensions.cs @@ -1,3 +1,4 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -17,6 +18,9 @@ namespace MLEM.Extensions { manager.PreferredBackBufferWidth = curr.Width; manager.PreferredBackBufferHeight = curr.Height; } else { + if (lastWidth <= 0 || lastHeight <= 0) + throw new InvalidOperationException("Can't call SetFullscreen to change out of fullscreen mode without going into fullscreen mode first"); + manager.PreferredBackBufferWidth = lastWidth; manager.PreferredBackBufferHeight = lastHeight; }