From f4d939da8123193c47ec899cd92b288c9a2ce053 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 9 Sep 2016 02:09:12 +0100 Subject: [PATCH] null checks on room in onRoomTimeline --- src/Notifier.js | 3 ++- src/components/structures/RoomView.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Notifier.js b/src/Notifier.js index c3ece7bbc1..4390083129 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -190,7 +190,7 @@ var Notifier = { setToolbarHidden: function(hidden, persistent = true) { this.toolbarHidden = hidden; - + // XXX: why are we dispatching this here? // this is nothing to do with notifier_enabled dis.dispatch({ @@ -226,6 +226,7 @@ var Notifier = { onRoomTimeline: function(ev, room, toStartOfTimeline, removed, data) { if (toStartOfTimeline) return; + if (!room) return; if (!this.isPrepared) return; // don't alert for any messages initially if (ev.sender && ev.sender.userId == MatrixClientPeg.get().credentials.userId) return; if (data.timeline.getTimelineSet() !== room.getUnfilteredTimelineSet()) return; diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 9cb113e25c..49d171f631 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -340,6 +340,7 @@ module.exports = React.createClass({ if (this.unmounted) return; // ignore events for other rooms + if (!room) return; if (!this.state.room || room.roomId != this.state.room.roomId) return; // ignore events from filtered timelines