1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-12-01 02:37:24 +01:00

Silence XCode static analysis false positive (#2309)

This commit is contained in:
omar 2019-01-27 23:30:44 +01:00
parent 8a605354ef
commit 13ca2fe845

View File

@ -4144,6 +4144,9 @@ ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup()
// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position. // We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position.
bool ImGui::IsMousePosValid(const ImVec2* mouse_pos) bool ImGui::IsMousePosValid(const ImVec2* mouse_pos)
{ {
// The assert is only to silence a false-positive in XCode Static Analysis.
// Because GImGui is not dereferenced in every code path, the static analyzer assume that it may be NULL (which it doesn't for other functions).
IM_ASSERT(GImGui != NULL);
const float MOUSE_INVALID = -256000.0f; const float MOUSE_INVALID = -256000.0f;
ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos; ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos;
return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID; return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID;