Skip to content

A platform for community discussion. Free, open, simple.

FIX: JS error when showing topic search results (#14551)

Penar Musarajaa00960638bf
diff --git a/app/assets/javascripts/discourse/app/widgets/search-menu-results.js b/app/assets/javascripts/discourse/app/widgets/search-menu-results.js
index cf435b74ec3..fda5656e450 100644
--- a/app/assets/javascripts/discourse/app/widgets/search-menu-results.js
+++ b/app/assets/javascripts/discourse/app/widgets/search-menu-results.js
@@ -61,7 +61,9 @@ export function addSearchSuggestion(value) {
class Highlighted extends RawHtml {
constructor(html, term) {
super({ html: `<span>${html}</span>` });
- this.term = term.replace(TOPIC_REPLACE_REGEXP, "");
+ if (term) {
+ this.term = term.replace(TOPIC_REPLACE_REGEXP, "");
+ }
}
decorate($html) {