From 28e2ea7af7e6aecbf8d9b38009734561684050d8 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 3 Oct 2016 00:19:39 -0700 Subject: [PATCH] Fix race condition between clearing index and inserting rest of catalog. --- src/General/Index.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index f9b547feb..78f2cc8ca 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -807,9 +807,11 @@ Index = buildCatalog: (threadIDs) -> i = 0 n = threadIDs.length + node0 = null fn = -> + return if node0 and !node0.parentNode # Index.root cleared j = if i > 0 and Index.root.parentNode then n else i + 30 - Index.buildCatalogPart threadIDs[i...j] + node0 = Index.buildCatalogPart(threadIDs[i...j])[0] i = j if i < n $.queueTask fn @@ -831,7 +833,7 @@ Index = $.add thread.catalogView.nodes.root, thread.OP.nodes.root nodes.push thread.catalogView.nodes.root $.add Index.root, nodes - return + nodes clearSearch: -> Index.searchInput.value = ''