Skip to content

Commit

Permalink
Fix wrongly asserting that PushRule::conditions is non-null
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Mar 4, 2022
1 parent fc5f0e8 commit 0c1924b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pushprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 0c1924b

Please sign in to comment.