From f88bf9cea35a3ac3b93c51526f03a058c822a991 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 30 Jul 2018 18:48:10 +0200 Subject: [PATCH] InvisibleButton: Added an assert to catch common type of passing zero-sized dimensions. (#1983) --- imgui.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index d7db96bb..594d5fec 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8332,6 +8332,9 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg) if (window->SkipItems) return false; + // Cannot use zero-size for InvisibleButton(). Unlike Button() there is not way to fallback using the label size. + IM_ASSERT(size_arg.x != 0.0f && size_arg.y != 0.0f); + const ImGuiID id = window->GetID(str_id); ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f); const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);