gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 82061b1202a81cef0bb4874e6a093cda56822f02
parent 7a1aa04bbbc9f95442c8850ef61d1d58bb12df74
Author: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>
Date:   Mon, 26 Sep 2022 08:39:59 +0100

[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>
Diffstat:
Minternal/federation/dereferencing/thread.go | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/internal/federation/dereferencing/thread.go b/internal/federation/dereferencing/thread.go @@ -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