mirror of
1
Fork 0

[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
1 changed files with 12 additions and 2 deletions

View File

@ -235,11 +235,11 @@ stackLoop:
// Start off the item iterator // Start off the item iterator
current.itemIter = items.Begin() current.itemIter = items.Begin()
current.iterIdx = -1 current.iterIdx = 0
} }
itemLoop: itemLoop:
for current.iterIdx++; current.iterIdx < current.iterLen; current.iterIdx++ { for ; current.iterIdx < current.iterLen; current.iterIdx++ {
var itemIRI *url.URL var itemIRI *url.URL
// Get next item iterator object // Get next item iterator object
@ -275,11 +275,21 @@ stackLoop:
continue itemLoop 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 // Put current and next frame at top of stack
stack = append(stack, current, &frame{ stack = append(stack, current, &frame{
statusIRI: itemIRI, statusIRI: itemIRI,
statusable: statusable, statusable: statusable,
}) })
// Now start at top of loop
continue stackLoop
} }
// Item iterator is done // Item iterator is done