diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-01-31 08:07:34 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-01-31 08:27:49 +1100 |
commit | 64782a433e6de09ed797266f463b2552ee6ae1c7 (patch) | |
tree | bebbbf5af082e1bedaa743ab20851681efcf599c /pkg/gui/files_panel.go | |
parent | 44edb49a6e9c24128a14517f60d1a75f70a539f8 (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/files_panel.go')
-rw-r--r-- | pkg/gui/files_panel.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 2128d67a7..1a35210da 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -173,9 +173,7 @@ func (gui *Gui) enterFile(forceSecondaryFocused bool, selectedLineIdx int) error if file.HasMergeConflicts { return gui.createErrorPanel(gui.g, gui.Tr.SLocalize("FileStagingRequirements")) } - if err := gui.changeMainViewsContext("staging"); err != nil { - return err - } + gui.changeMainViewsContext("staging") if err := gui.switchFocus(gui.g, gui.getFilesView(), gui.getMainView()); err != nil { return err } @@ -497,9 +495,7 @@ func (gui *Gui) handleSwitchToMerge(g *gocui.Gui, v *gocui.View) error { if !file.HasInlineMergeConflicts { return gui.createErrorPanel(g, gui.Tr.SLocalize("FileNoMergeCons")) } - if err := gui.changeMainViewsContext("merging"); err != nil { - return err - } + gui.changeMainViewsContext("merging") if err := gui.switchFocus(g, v, gui.getMainView()); err != nil { return err } |