mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Fix possible crash with auto-forwarding branches
I'm not aware of any real scenario where this can happen, but we have seen one stack trace where it crashed with an out-of-bounds error in the range expression below, so there must be a way. And it seems better to guard against it anyway, rather than assuming it can't happen.
This commit is contained in:
@ -270,8 +270,12 @@ func (self *BranchesHelper) AutoForwardBranches() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
allBranches := self.c.UserConfig().Git.AutoForwardBranches == "allBranches"
|
|
||||||
branches := self.c.Model().Branches
|
branches := self.c.Model().Branches
|
||||||
|
if len(branches) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
allBranches := self.c.UserConfig().Git.AutoForwardBranches == "allBranches"
|
||||||
updateCommands := ""
|
updateCommands := ""
|
||||||
// The first branch is the currently checked out branch; skip it
|
// The first branch is the currently checked out branch; skip it
|
||||||
for _, branch := range branches[1:] {
|
for _, branch := range branches[1:] {
|
||||||
|
Reference in New Issue
Block a user