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; }