Skip to content

Commit

Permalink
Tables, Error Handling: Recovery from invalid index in TableSetColumn…
Browse files Browse the repository at this point in the history
…Index(). (ocornut#1651)
  • Loading branch information
ocornut committed Feb 13, 2025
1 parent e1ae7db commit 98c2f6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Other changes:
overridden when hot-reloading .ini state. (#7934)
- Tables: tamed some .ini settings optimizations to more accurately allow
overwriting/hot-reloading settings in more situations. (#7934)
- Tables, Error Handling: Recovery from invalid index in TableSetColumnIndex(). (#1651)
- Styles, Tabs: made the Close Button of selected tabs always visible by default,
without requiring to hover the tab. (#8387)
- Added style.TabCloseButtonMinWidthSelected/TabCloseButtonMinWidthUnselected settings
Expand Down
6 changes: 5 additions & 1 deletion imgui_tables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,11 @@ bool ImGui::TableSetColumnIndex(int column_n)
{
if (table->CurrentColumn != -1)
TableEndCell(table);
IM_ASSERT(column_n >= 0 && table->ColumnsCount);
if ((column_n >= 0 && column_n < table->ColumnsCount) == false)
{
IM_ASSERT_USER_ERROR(column_n >= 0 && column_n < table->ColumnsCount, "TableSetColumnIndex() invalid column index!");
return false;
}
TableBeginCell(table, column_n);
}

Expand Down

0 comments on commit 98c2f6b

Please sign in to comment.