From 28b09199de92c4e1b7e15c4797b2c4243909f4ea Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 16 May 2016 19:25:42 +0200 Subject: [PATCH] ImGuiListClipper: removed assert (#662) --- imgui.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 6db38d719..27c88caae 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1644,9 +1644,7 @@ void ImGuiListClipper::End() { if (ItemsCount < 0) return; - float cur_y = ImGui::GetCursorPosY(); (void)cur_y; - float expected_display_end_y = StartPosY + DisplayEnd * ItemsHeight; - IM_ASSERT(fabsf(cur_y - expected_display_end_y) < 1.0f); // if this triggers, it probably means your items have varying height (in which case you can't use this helper) or the explicit height you have passed was incorrect. + // In theory here we should assert that ImGui::GetCursorPosY() == StartPosY + DisplayEnd * ItemsHeight, but it feels saner to just seek at the end and not assert/crash the user. if (ItemsCount < INT_MAX) SetCursorPosYAndSetupDummyPrevLine(StartPosY + ItemsCount * ItemsHeight, ItemsHeight); // advance cursor ItemsCount = -1;