From 5492a2cf945601a29bbe1da023536e2c73af8fac Mon Sep 17 00:00:00 2001 From: Cody Tapscott Date: Wed, 18 Jan 2023 08:59:20 -0700 Subject: [PATCH] emscripten: Handle unsupported glfwGetVideoMode() --- profiler/src/imgui/imgui_impl_glfw.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/profiler/src/imgui/imgui_impl_glfw.cpp b/profiler/src/imgui/imgui_impl_glfw.cpp index b47e0106..a724b5b5 100644 --- a/profiler/src/imgui/imgui_impl_glfw.cpp +++ b/profiler/src/imgui/imgui_impl_glfw.cpp @@ -765,6 +765,11 @@ static void ImGui_ImplGlfw_UpdateMonitors() int x, y; glfwGetMonitorPos(glfw_monitors[n], &x, &y); const GLFWvidmode* vid_mode = glfwGetVideoMode(glfw_monitors[n]); + if (vid_mode == NULL) { // Failed to get Video mode (e.g. Emscripten does not support this function) + bd->WantUpdateMonitors = false; + platform_io.Monitors.resize(0); + return; + } monitor.MainPos = monitor.WorkPos = ImVec2((float)x, (float)y); monitor.MainSize = monitor.WorkSize = ImVec2((float)vid_mode->width, (float)vid_mode->height); #if GLFW_HAS_MONITOR_WORK_AREA