about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-01-25 17:49:22 -0600
committerPaul Frazee <pfrazee@gmail.com>2023-01-25 17:49:22 -0600
commite08a46f0c64d11c6f62561f7861356f14b011ae2 (patch)
tree7c484701d2519623c4b7094704c6d8c9f740fe8d /src
parent1090783f91ad92c4d9266ec72b64af7c02aacb56 (diff)
downloadvoidsky-e08a46f0c64d11c6f62561f7861356f14b011ae2.tar.zst
Add a sanity check to avoid bad references, close #77
Diffstat (limited to 'src')
-rw-r--r--src/state/models/feed-view.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts
index a7e3c6155..d8eb95ef2 100644
--- a/src/state/models/feed-view.ts
+++ b/src/state/models/feed-view.ts
@@ -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
     }
   }