|
@@ -2860,6 +2860,11 @@ void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col)
|
|
|
void ImGui::PopStyleColor(int count)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ if (g.ColorStack.Size < count)
|
|
|
+ {
|
|
|
+ IM_ASSERT_USER_ERROR(g.ColorStack.Size > count, "Calling PopStyleColor() too many times: stack underflow.");
|
|
|
+ count = g.ColorStack.Size;
|
|
|
+ }
|
|
|
while (count > 0)
|
|
|
{
|
|
|
ImGuiColorMod& backup = g.ColorStack.back();
|
|
@@ -2944,6 +2949,11 @@ void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
|
|
|
void ImGui::PopStyleVar(int count)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ if (g.StyleVarStack.Size < count)
|
|
|
+ {
|
|
|
+ IM_ASSERT_USER_ERROR(g.StyleVarStack.Size > count, "Calling PopStyleVar() too many times: stack underflow.");
|
|
|
+ count = g.StyleVarStack.Size;
|
|
|
+ }
|
|
|
while (count > 0)
|
|
|
{
|
|
|
// We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it.
|