From d1dc84c6321f45e922c8584fdfb71445ec4eaddc Mon Sep 17 00:00:00 2001 From: moneyl <8206401+Moneyl@users.noreply.github.com> Date: Mon, 20 Jan 2020 21:18:11 -0500 Subject: [PATCH] Fix crash when minimizing game window (#933) Returns early if the window or framebuffer width or height = 0 to avoid dividing by zero. Checked the vector components individually instead of using `Vector2i.Equals()` because you can end up in a situation where width is non-zero and height is zero if you manually resize the window instead of using the minimize button. --- Robust.Client/Graphics/Clyde/Clyde.Windowing.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs b/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs index 880404e3da..7a6ea7d008 100644 --- a/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs +++ b/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs @@ -292,8 +292,11 @@ namespace Robust.Client.Graphics.Clyde var oldSize = _framebufferSize; GLFW.GetFramebufferSize(window, out var fbW, out var fbH); _framebufferSize = (fbW, fbH); - _windowSize = (width, height); + + if(fbW == 0 || fbH == 0 || width == 0 || height == 0) + return; + _pixelRatio = _framebufferSize / _windowSize; GL.Viewport(0, 0, fbW, fbH);