From 9b37ef05fd03648f5769c5a652cd70140739ed24 Mon Sep 17 00:00:00 2001 From: Frank Benkstein Date: Tue, 2 Jan 2024 12:44:24 +0100 Subject: [PATCH] fix omnibar crash when encountering tabs without title The "url" and "title" properties of tab objects are optional an can be null sometimes. When a tab with either of these properties being null is encountered the interactive search just breaks without updating the completion suggestions. --- background_scripts/completion.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/background_scripts/completion.js b/background_scripts/completion.js index 6865cc358..40019e2e5 100644 --- a/background_scripts/completion.js +++ b/background_scripts/completion.js @@ -487,8 +487,8 @@ class TabCompleter { const suggestion = new Suggestion({ queryTerms, description: "tab", - url: tab.url, - title: tab.title, + url: tab.url || "", + title: tab.title || "", tabId: tab.id, deDuplicate: false, }); @@ -693,7 +693,7 @@ const RankingUtils = { let matchedTerm = false; for (const thing of things) { if (!matchedTerm) { - matchedTerm = thing.match(regexp); + matchedTerm = thing?.match(regexp); } } if (!matchedTerm) return false;