Skip to content

Commit

Permalink
More typeerrors
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Dec 12, 2023
1 parent d17653c commit 24589d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/manager/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const PROCESSING_CHANGE_TIMEOUT = 500;

function mapReduce(l, id, fn) {
const results = {};
if (!l || l.length === 0) {
return results;
}
for (let i = 0; i < l.length; i++) {
const x = l[i];
results[x[id]] = fn(x);
Expand Down Expand Up @@ -98,7 +101,7 @@ export const documents = new Svue({
},
pendingExisting(docsById, pending) {
if (!pending) return [];
return pending.filter((x) => {
return pending?.filter((x) => {
const id = x.doc_id;
return docsById[id] != null;
});
Expand Down
3 changes: 2 additions & 1 deletion src/util/coalesceHighlights.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export function coalesceSelectableHighlights(words, highlights) {
while (textBlock.length > 0) {
// Go through each text object
const text =
leftoverText + words[seekI].text.toLowerCase().replace(/\s/g, "");
leftoverText +
words[seekI]?.text?.toLowerCase().replace(/\s/g, "") ?? "";
if (!textBlock.startsWith(text) && !text.startsWith(textBlock)) {
// Not a match: abort
matched = false;
Expand Down

0 comments on commit 24589d7

Please sign in to comment.