Skip to content

Commit

Permalink
fix TableGetColumnSortSpecs accepting invalid negative indices
Browse files Browse the repository at this point in the history
  • Loading branch information
cfillion committed Feb 4, 2024
1 parent dfb2a3b commit 1e7945b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ See TableNeedSort.)")
FRAME_GUARD;

const ImGuiTableSortSpecs *specs { ImGui::TableGetSortSpecs() };
if(!specs || id >= specs->SpecsCount)
return false;
if(!specs || id < 0 || id >= specs->SpecsCount)
return false; // don't assert: user cannot know how many specs there are

const ImGuiTableColumnSortSpecs &spec { specs->Specs[id] };
if(API_W(column_user_id)) *API_W(column_user_id) = spec.ColumnUserID;
Expand Down

0 comments on commit 1e7945b

Please sign in to comment.