Viewports: Hotfix for crash in monitor array access, caused by 4b9bc4902. (#3967)

This commit is contained in:
ocornut 2021-03-25 17:13:25 +01:00
parent e7577d570e
commit b305953bd1

View File

@ -12064,7 +12064,7 @@ const ImGuiPlatformMonitor* ImGui::GetViewportPlatformMonitor(ImGuiViewport* vie
ImGuiContext& g = *GImGui;
ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)viewport_p;
int monitor_idx = viewport->PlatformMonitor;
if (monitor_idx >= 0 || monitor_idx < g.PlatformIO.Monitors.Size)
if (monitor_idx >= 0 && monitor_idx < g.PlatformIO.Monitors.Size)
return &g.PlatformIO.Monitors[monitor_idx];
return &g.FallbackMonitor;
}