mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Fix potential crash when reloading the config after removing a branch log command
When cycling to the last branch log command, and then editing the config to remove one or more log commands, lazygit would crash with an out of bounds panic when returning to it. Fix this by resetting the log index to 0 when it is out of bounds. (I think resetting to 0 is better than clamping, although it doesn't matter much.)
This commit is contained in:
parent
19f88290a2
commit
220cde1376
|
|
@ -278,6 +278,10 @@ func (self *BranchCommands) allBranchesLogCandidates() []string {
|
|||
func (self *BranchCommands) AllBranchesLogCmdObj() *oscommands.CmdObj {
|
||||
candidates := self.allBranchesLogCandidates()
|
||||
|
||||
if self.allBranchesLogCmdIndex >= len(candidates) {
|
||||
self.allBranchesLogCmdIndex = 0
|
||||
}
|
||||
|
||||
i := self.allBranchesLogCmdIndex
|
||||
return self.cmd.New(str.ToArgv(candidates[i])).DontLog()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue