mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Error Handling, Tables: TableGetSortSpecs() silently return NULL when no table (matching most other table getters). TableSetBgColor() uses IM_ASSERT_USER_ERROR.
This commit is contained in:
parent
a0d3e405a3
commit
79d88e2d0b
2 changed files with 9 additions and 3 deletions
|
|
@ -43,6 +43,9 @@ Breaking Changes:
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
- Error Handling: minor improvements to error handling for TableGetSortSpecs()
|
||||||
|
and TableSetBgColor() calls. (#1651, #8499)
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
VERSION 1.92.1 (Released 2025-07-09)
|
VERSION 1.92.1 (Released 2025-07-09)
|
||||||
|
|
|
||||||
|
|
@ -1825,6 +1825,11 @@ void ImGui::TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiTable* table = g.CurrentTable;
|
ImGuiTable* table = g.CurrentTable;
|
||||||
IM_ASSERT(target != ImGuiTableBgTarget_None);
|
IM_ASSERT(target != ImGuiTableBgTarget_None);
|
||||||
|
if (table == NULL)
|
||||||
|
{
|
||||||
|
IM_ASSERT_USER_ERROR(table != NULL, "Call should only be done while in BeginTable() scope!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (color == IM_COL32_DISABLE)
|
if (color == IM_COL32_DISABLE)
|
||||||
color = 0;
|
color = 0;
|
||||||
|
|
@ -2876,9 +2881,7 @@ ImGuiTableSortSpecs* ImGui::TableGetSortSpecs()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiTable* table = g.CurrentTable;
|
ImGuiTable* table = g.CurrentTable;
|
||||||
IM_ASSERT(table != NULL);
|
if (table == NULL || !(table->Flags & ImGuiTableFlags_Sortable))
|
||||||
|
|
||||||
if (!(table->Flags & ImGuiTableFlags_Sortable))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Require layout (in case TableHeadersRow() hasn't been called) as it may alter IsSortSpecsDirty in some paths.
|
// Require layout (in case TableHeadersRow() hasn't been called) as it may alter IsSortSpecsDirty in some paths.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue