Skip to content

Commit

Permalink
Fix wrongly asserting that PushRule::conditions is non-null (#2217)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Mar 4, 2022
1 parent 5d54bf5 commit 9e4f109
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 9e4f109

Please sign in to comment.