Skip to content

Commit 0e90546

Browse files
committed
fix(stash): skip invalid stash entries
1 parent db2e912 commit 0e90546

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

repo_stash.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (r *Repository) StashList(opts ...StashListOptions) ([]*Stash, error) {
4343

4444
var stash *Stash
4545
lines := strings.Split(stdout.String(), "\n")
46-
for i := 0; i < len(lines); i++ {
46+
for i := range lines {
4747
line := strings.TrimSpace(lines[i])
4848
// Init entry
4949
if match := stashLineRegexp.FindStringSubmatch(line); len(match) == 3 {
@@ -54,7 +54,7 @@ func (r *Repository) StashList(opts ...StashListOptions) ([]*Stash, error) {
5454

5555
idx, err := strconv.Atoi(match[1])
5656
if err != nil {
57-
idx = -1
57+
continue
5858
}
5959
stash = &Stash{
6060
Index: idx,

0 commit comments

Comments
 (0)