wtclient: make addr iterator panic safe

Ensure that calling Next twice in a row without first calling Reset is
safe when the iterator is at the end of its list. Also alter the
towerListIterator to call Reset after hitting an error on Next.
This commit is contained in:
Elle Mouton committed 2023-03-30 12:29:41 +02:00
1 parent 1047514515
commit 9e4c8dd509
3 files changed
+6 -7

No files matched your search

@@ -145,6 +145,7 @@ func (t *towerListIterator) AddCandidate(candidate *Tower) {
for {
next, err := candidate.Addresses.Next()
if err != nil {
candidate.Addresses.Reset()
break
}