From 0c1924be23e18490bcd97a7c224022cb8c6fc156 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 4 Mar 2022 08:12:35 +0000 Subject: [PATCH] Fix wrongly asserting that PushRule::conditions is non-null --- src/pushprocessor.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pushprocessor.ts b/src/pushprocessor.ts index 7e551202c5d..ae170751f00 100644 --- a/src/pushprocessor.ts +++ b/src/pushprocessor.ts @@ -158,8 +158,7 @@ export class PushProcessor { .find((r) => r.rule_id === override.rule_id); if (existingRule) { - // Copy over the actions, default, and conditions. Don't touch the user's - // preference. + // Copy over the actions, default, and conditions. Don't touch the user's preference. existingRule.default = override.default; existingRule.conditions = override.conditions; existingRule.actions = override.actions; @@ -447,6 +446,8 @@ export class PushProcessor { } public ruleMatchesEvent(rule: IPushRule, ev: MatrixEvent): boolean { + if (!rule.conditions?.length) return true; + let ret = true; for (let i = 0; i < rule.conditions.length; ++i) { const cond = rule.conditions[i];