From 5df0fe076576b2a0e3c128419360aa426bc337d6 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 30 Oct 2021 18:06:39 +1100 Subject: fix crash --- pkg/commands/loading_commits.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'pkg/commands') diff --git a/pkg/commands/loading_commits.go b/pkg/commands/loading_commits.go index 57cfae8b5..d22c803de 100644 --- a/pkg/commands/loading_commits.go +++ b/pkg/commands/loading_commits.go @@ -183,6 +183,10 @@ func (c *CommitListBuilder) getHydratedRebasingCommits(rebaseMode string) ([]*mo return nil, err } + if len(commits) == 0 { + return nil, nil + } + commitShas := make([]string, len(commits)) for i, commit := range commits { commitShas[i] = commit.Sha @@ -202,11 +206,11 @@ func (c *CommitListBuilder) getHydratedRebasingCommits(rebaseMode string) ([]*mo hydratedCommits := make([]*models.Commit, 0, len(commits)) i := 0 err = oscommands.RunLineOutputCmd(cmd, func(line string) (bool, error) { - c.Log.Warn(line) if canExtractCommit(line) { commit := c.extractCommitFromLine(line) - commit.Action = commits[i].Action - commit.Status = commits[i].Status + matchingCommit := commits[i] + commit.Action = matchingCommit.Action + commit.Status = matchingCommit.Status hydratedCommits = append(hydratedCommits, commit) i++ } -- cgit v1.2.3