Fix crash on minimize with GLFW shell (#9278)

Fixes a divide-by-zero in pixel density computation.
This commit is contained in:
stuartmorgan 2019-06-11 11:50:19 -07:00 committed by GitHub
parent 8d017faea4
commit 95f9b3db6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,7 +176,8 @@ static void GLFWFramebufferSizeCallback(GLFWwindow* window,
glfwGetWindowSize(window, &width, nullptr);
auto state = GetSavedWindowState(window);
state->window_wrapper->pixels_per_screen_coordinate = width_px / width;
state->window_wrapper->pixels_per_screen_coordinate =
width > 0 ? width_px / width : 1;
double dpi = state->window_wrapper->pixels_per_screen_coordinate *
state->monitor_screen_coordinates_per_inch;