mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-25 21:26:40 +00:00
[bugfix] more nil checks baybeeeeeeeeeeeeeeeeeeee (#854)
* more nil checks baybeeeeeeeeeeeeeeeeeeee Signed-off-by: kim <grufwub@gmail.com> * move item nil checks Signed-off-by: kim <grufwub@gmail.com> Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
7bea107608
commit
15a67b7bef
|
@ -152,8 +152,6 @@ type frame struct {
|
|||
statusable ap.Statusable
|
||||
page ap.CollectionPageable
|
||||
itemIter vocab.ActivityStreamsItemsPropertyIterator
|
||||
iterLen int
|
||||
iterIdx int
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -240,22 +238,22 @@ type frame struct {
|
|||
continue stackLoop
|
||||
}
|
||||
|
||||
// Check this page contains any items...
|
||||
if current.iterLen = items.Len(); current.iterLen == 0 {
|
||||
continue stackLoop
|
||||
}
|
||||
|
||||
// Start off the item iterator
|
||||
current.itemIter = items.Begin()
|
||||
current.iterIdx = 0
|
||||
if current.itemIter == nil {
|
||||
continue stackLoop
|
||||
}
|
||||
}
|
||||
|
||||
itemLoop:
|
||||
for ; current.iterIdx < current.iterLen; current.iterIdx++ {
|
||||
for {
|
||||
var itemIRI *url.URL
|
||||
|
||||
// Get next item iterator object
|
||||
current.itemIter = current.itemIter.Next()
|
||||
if current.itemIter == nil {
|
||||
break itemLoop
|
||||
}
|
||||
|
||||
if iri := current.itemIter.GetIRI(); iri != nil {
|
||||
// Item is already an IRI type
|
||||
|
@ -284,13 +282,6 @@ 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,
|
||||
|
@ -301,9 +292,6 @@ type frame struct {
|
|||
continue stackLoop
|
||||
}
|
||||
|
||||
// Item iterator is done
|
||||
current.itemIter = nil
|
||||
|
||||
// Get the current page's "next" property
|
||||
pageNext := current.page.GetActivityStreamsNext()
|
||||
if pageNext == nil {
|
||||
|
|
Loading…
Reference in a new issue