diff --git a/src/search.js b/src/search.js index e336031e45..0a0d1f459c 100644 --- a/src/search.js +++ b/src/search.js @@ -58,7 +58,7 @@ async function searchInContent(data) { } let pids = []; let tids = []; - const inTopic = data.query.match(/^in:topic-([\d]+) /); + const inTopic = String(data.query || '').match(/^in:topic-([\d]+) /); if (inTopic) { const tid = inTopic[1]; const cleanedTerm = data.query.replace(inTopic[0], '');