Add a sanity check to avoid bad references, close #77

zio/stable
Paul Frazee 2023-01-25 17:49:22 -06:00
parent 1090783f91
commit e08a46f0c6
1 changed files with 4 additions and 1 deletions

View File

@ -609,7 +609,10 @@ function preprocessFeed(feed: FeedViewPost[]): FeedViewPostWithThreadMeta[] {
for (const slice of threadSlices) {
if (slice.length > 3) {
reorg.splice(slice.index - removedCount + 1, slice.length - 3)
reorg[slice.index - removedCount]._isThreadChildElided = true
if (reorg[slice.index - removedCount]) {
// ^ sanity check
reorg[slice.index - removedCount]._isThreadChildElided = true
}
removedCount += slice.length - 3
}
}