Don't crash if there isn't a room notif rule

This commit is contained in:
David Baker 2017-11-10 11:50:00 +00:00
parent be5e67245b
commit ff5e00d244

View file

@ -224,7 +224,7 @@ module.exports = React.createClass({
if (roomNotifTextNodes.length > 0) { if (roomNotifTextNodes.length > 0) {
const pushProcessor = new PushProcessor(MatrixClientPeg.get()); const pushProcessor = new PushProcessor(MatrixClientPeg.get());
const atRoomRule = pushProcessor.getPushRuleById(".m.rule.roomnotif"); const atRoomRule = pushProcessor.getPushRuleById(".m.rule.roomnotif");
if (pushProcessor.ruleMatchesEvent(atRoomRule, this.props.mxEvent)) { if (atRoomRule && pushProcessor.ruleMatchesEvent(atRoomRule, this.props.mxEvent)) {
// Now replace all those nodes with Pills // Now replace all those nodes with Pills
for (const roomNotifTextNode of roomNotifTextNodes) { for (const roomNotifTextNode of roomNotifTextNodes) {
const pillContainer = document.createElement('span'); const pillContainer = document.createElement('span');