Skip to content

Commit

Permalink
Merge pull request #753 from bytesiz3d/master
Browse files Browse the repository at this point in the history
Check if no Columns or Rows were sent to TableWidget
  • Loading branch information
gucio321 authored Jan 25, 2024
2 parents c953bb6 + 4c462e5 commit 023d760
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion TableWidgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ func (t *TableWidget) Flags(flags TableFlags) *TableWidget {
func (t *TableWidget) Build() {
colCount := len(t.columns)
if colCount == 0 {
colCount = len(t.rows[0].layout)
if len(t.rows) > 0 {
colCount = len(t.rows[0].layout)
} else {
// No rows or columns, pass a single column to BeginTable
colCount = 1
}
}

if imgui.BeginTableV(t.id, int32(colCount), imgui.TableFlags(t.flags), t.size, float32(t.innerWidth)) {
Expand Down

0 comments on commit 023d760

Please sign in to comment.