diff --git a/internal/federation/dereferencing/thread.go b/internal/federation/dereferencing/thread.go index d15f05964..7626454a6 100644 --- a/internal/federation/dereferencing/thread.go +++ b/internal/federation/dereferencing/thread.go @@ -235,11 +235,11 @@ type frame struct { // 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 @@ type frame struct { 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