Skip to content

Commit

Permalink
Viewports: Hotfix for crash in monitor array access, caused by 4b9bc49.…
Browse files Browse the repository at this point in the history
… (#3967)
  • Loading branch information
ocornut committed Mar 25, 2021
1 parent e7577d5 commit b305953
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b305953

Please sign in to comment.