Skip to content

Commit

Permalink
Fix ignored error warnings in List.iterate. (#4450)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr authored Dec 19, 2019
1 parent bde6d10 commit 6357d2e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions posting/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ func (l *List) iterate(readTs uint64, afterUid uint64, f func(obj *pb.Posting) e
if err != nil {
return err
}

loop:
for err == nil {
if midx < mlen {
mp = mposts[midx]
Expand All @@ -599,23 +601,33 @@ func (l *List) iterate(readTs uint64, afterUid uint64, f func(obj *pb.Posting) e
case mp.Uid == 0 || (pp.Uid > 0 && pp.Uid < mp.Uid):
// Either mp is empty, or pp is lower than mp.
err = f(pp)
if err := pitr.next(); err != nil {
return err
if err != nil {
break loop
}

if err = pitr.next(); err != nil {
break loop
}
case pp.Uid == 0 || (mp.Uid > 0 && mp.Uid < pp.Uid):
// Either pp is empty, or mp is lower than pp.
if mp.Op != Del {
err = f(mp)
if err != nil {
break loop
}
}
prevUid = mp.Uid
midx++
case pp.Uid == mp.Uid:
if mp.Op != Del {
err = f(mp)
if err != nil {
break loop
}
}
prevUid = mp.Uid
if err := pitr.next(); err != nil {
return err
if err = pitr.next(); err != nil {
break loop
}
midx++
default:
Expand Down

0 comments on commit 6357d2e

Please sign in to comment.