refactor(iter): use HasNext() in guard of Next()

This commit is contained in:
XMLHexagram 2024-03-24 23:30:01 +08:00
parent eaf8395c6e
commit 7a110fa069
3 changed files with 3 additions and 3 deletions

View File

@ -132,7 +132,7 @@ func (i *iter) process(ctx context.Context) (ret bool, skip bool) {
}()
// end of iteration or error occurred
if i.i >= len(i.dialogs) || i.j >= len(i.dialogs[i.i].Messages) || i.err != nil {
if !i.HasNext() {
return false, false
}

View File

@ -93,7 +93,7 @@ func (i *iter) Next(ctx context.Context) bool {
}
// end of iteration or error occurred
if i.i >= len(i.opts.dialogs) || i.err != nil {
if !i.HasNext() {
return false
}

View File

@ -53,7 +53,7 @@ func (i *iter) Next(ctx context.Context) bool {
default:
}
if i.cur >= len(i.files) || i.err != nil {
if !i.HasNext() {
return false
}