1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

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.
This commit is contained in:
Jesse Duffield
2020-01-31 08:07:34 +11:00
parent 44edb49a6e
commit 64782a433e
8 changed files with 19 additions and 23 deletions

View File

@ -29,7 +29,9 @@ func (gui *Gui) handleCommitFileSelect(g *gocui.Gui, v *gocui.View) error {
}
gui.getMainView().Title = "Patch"
gui.State.Panels.LineByLine = nil
if gui.currentViewName() == "commitFiles" {
gui.handleEscapeLineByLinePanel()
}
commitFile := gui.getSelectedCommitFile(g)
if commitFile == nil {
@ -194,9 +196,7 @@ func (gui *Gui) enterCommitFile(selectedLineIdx int) error {
}
}
if err := gui.changeMainViewsContext("patch-building"); err != nil {
return err
}
gui.changeMainViewsContext("patch-building")
if err := gui.switchFocus(gui.g, gui.getCommitFilesView(), gui.getMainView()); err != nil {
return err
}