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.
This commit is contained in:
Luke Adams 2018-10-05 11:39:36 -06:00
parent f50d65b892
commit 3378e6409e

View File

@ -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 {