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.
This commit is contained in:
moneyl
2020-01-21 03:18:11 +01:00
committed by Pieter-Jan Briers
parent 861e19da76
commit d1dc84c632
@@ -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);