Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
filter: Fix bug where invalid stream name could throw an error.
evykassirer7bff14932575
diff --git a/web/src/filter.ts b/web/src/filter.tsindex 7b4965e7075..f196975ae01 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -724,14 +724,17 @@ export class Filter {Filter.canonicalize_operator(term.operator) === expected && !term.negated;if (is(terms[0], "channel") && is(terms[1], "topic")) {- const channel = stream_data.get_valid_sub_by_id_string(terms[0].operand).name;- const topic = terms[1].operand;- parts.push({- type: "channel_topic",- channel,- topic,- });- terms = terms.slice(2);+ // `channel` might be undefined if it's coming from a text query+ const channel = stream_data.get_sub_by_id_string(terms[0].operand)?.name;+ if (channel) {+ const topic = terms[1].operand;+ parts.push({+ type: "channel_topic",+ channel,+ topic,+ });+ terms = terms.slice(2);+ }}}