From c96894c0cfcce31e36cc63de7aa43e8b1c815e01 Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Sat, 10 Mar 2018 12:59:42 +0100 Subject: [PATCH] Bugfix which caused a crash in Table class. Fixes #67 --- application.go | 8 +++++--- table.go | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/application.go b/application.go index debe11c..15911b1 100644 --- a/application.go +++ b/application.go @@ -270,9 +270,11 @@ func (a *Application) SetFocus(p Primitive) *Application { a.screen.HideCursor() } a.Unlock() - p.Focus(func(p Primitive) { - a.SetFocus(p) - }) + if p != nil { + p.Focus(func(p Primitive) { + a.SetFocus(p) + }) + } return a } diff --git a/table.go b/table.go index c23cd71..003bd43 100644 --- a/table.go +++ b/table.go @@ -582,6 +582,7 @@ ColumnLoop: tableWidth -= widths[t.fixedColumns] + 1 columns = append(columns[:t.fixedColumns], columns[t.fixedColumns+1:]...) widths = append(widths[:t.fixedColumns], widths[t.fixedColumns+1:]...) + expansions = append(expansions[:t.fixedColumns], expansions[t.fixedColumns+1:]...) } // What's this column's width (without expansion)?