mirror of
https://github.com/iyear/tdl
synced 2025-01-08 11:57:55 +08:00
refactor(iter): use HasNext() in guard of Next()
This commit is contained in:
parent
eaf8395c6e
commit
7a110fa069
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user