From 0c39e8283e375f3e7dd4c705abb3a2f56d72e593 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 11 Jun 2019 11:50:19 -0700 Subject: [PATCH] Fix crash on minimize with GLFW shell (flutter/engine#9278) Fixes a divide-by-zero in pixel density computation. --- engine/src/flutter/shell/platform/glfw/flutter_glfw.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc b/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc index 20f2c8617c..699f8cba76 100644 --- a/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc +++ b/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc @@ -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;