[bugfix] panic during child thread iteration (#852)

* *actually* start at top of stack loop on find remote child, fix iter indexing

Signed-off-by: kim <grufwub@gmail.com>

* add improved code comment

Signed-off-by: kim <grufwub@gmail.com>

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2022-09-26 08:39:59 +01:00 committed by GitHub
parent 7a1aa04bbb
commit 82061b1202
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -235,11 +235,11 @@ stackLoop:
// Start off the item iterator
current.itemIter = items.Begin()
current.iterIdx = -1
current.iterIdx = 0
}
itemLoop:
for current.iterIdx++; current.iterIdx < current.iterLen; current.iterIdx++ {
for ; current.iterIdx < current.iterLen; current.iterIdx++ {
var itemIRI *url.URL
// Get next item iterator object
@ -275,11 +275,21 @@ stackLoop:
continue itemLoop
}
// Iter past this item. Normally this would be
// handled by the third clause of the itemLoop's
// embedded range checking, but at the bottom of this
// loop since we found a new status we circle back to
// the beginning of the stackLoop and skip iteration.
current.iterIdx++
// Put current and next frame at top of stack
stack = append(stack, current, &frame{
statusIRI: itemIRI,
statusable: statusable,
})
// Now start at top of loop
continue stackLoop
}
// Item iterator is done