2
0
Эх сурвалжийг харах

Silence XCode static analysis false positive (#2309)

omar 6 жил өмнө
parent
commit
13ca2fe845
1 өөрчлөгдсөн 3 нэмэгдсэн , 0 устгасан
  1. 3 0
      imgui.cpp

+ 3 - 0
imgui.cpp

@@ -4144,6 +4144,9 @@ ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup()
 // We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position.
 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;
     ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos;
     return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID;