aboutsummaryrefslogtreecommitdiffstats
path: root/termui/label_select.go
diff options
context:
space:
mode:
authorLuke Adams <lukeclydeadams@gmail.com>2018-10-05 11:39:36 -0600
committerLuke Adams <lukeclydeadams@gmail.com>2018-10-05 11:52:41 -0600
commit3378e6409e44b281fcded6a77da0fcbea1cfb692 (patch)
tree45279067c85ab0b3f2eed27e69bd6153010c5c4a /termui/label_select.go
parentf50d65b89233a0a0f442c577fcd9820b4a0cae85 (diff)
downloadgit-bug-3378e6409e44b281fcded6a77da0fcbea1cfb692.tar.gz
Fix bug in labelSelect addItem
Adding a new item would cause a panic because focusView attempted to access a view that did not yet exist. Fixed by calling layout before calling focusView.
Diffstat (limited to 'termui/label_select.go')
-rw-r--r--termui/label_select.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/termui/label_select.go b/termui/label_select.go
index 47fcc4b1..696f21d5 100644
--- a/termui/label_select.go
+++ b/termui/label_select.go
@@ -228,8 +228,10 @@ func (ls *labelSelect) addItem(g *gocui.Gui, v *gocui.View) error {
ls.labelSelect = append(ls.labelSelect, true)
ls.selected = len(ls.labels) - 1
+ ls.layout(g)
+
if err := ls.focusView(g); err != nil {
- return err
+ panic(err)
}
g.Update(func(gui *gocui.Gui) error {