summaryrefslogtreecommitdiffstats
path: root/pkg/gui/gui.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-01-31 08:07:34 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-01-31 08:27:49 +1100
commit64782a433e6de09ed797266f463b2552ee6ae1c7 (patch)
treebebbbf5af082e1bedaa743ab20851681efcf599c /pkg/gui/gui.go
parent44edb49a6e9c24128a14517f60d1a75f70a539f8 (diff)
fix segfault on line by line panel
The state object is sometimes undefined in the onclick method of the line by line panel. Because we set it to nil in a bunch of places, I've decided to just change the main context to 'normal' before setting it to nil anywhere. That way the keybindings for the line by line panel won't get executed and we won't get a segfault.
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r--pkg/gui/gui.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 7da7f53fa..c8e8453c5 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -348,9 +348,7 @@ func (gui *Gui) onFocusLost(v *gocui.View, newView *gocui.View) error {
}
case "main":
// if we have lost focus to a first-class panel, we need to do some cleanup
- if err := gui.changeMainViewsContext("normal"); err != nil {
- return err
- }
+ gui.changeMainViewsContext("normal")
case "commitFiles":
if gui.State.MainContext != "patch-building" {
if _, err := gui.g.SetViewOnBottom(v.Name()); err != nil {
@@ -698,9 +696,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
}
func (gui *Gui) onInitialViewsCreation() error {
- if err := gui.changeMainViewsContext("normal"); err != nil {
- return err
- }
+ gui.changeMainViewsContext("normal")
gui.getBranchesView().Context = "local-branches"
gui.getCommitsView().Context = "branch-commits"