Add null-guard to prevent RoomAvatar NPE when room is null

which may have been occuring when peeking into a room that the
client hasn't got a Room object for.

Fixes https://github.com/vector-im/riot-web/issues/6432
pull/21833/head
Luke Barnard 2018-04-03 17:35:34 +01:00
parent a79c558763
commit 8ca1243ecb
1 changed files with 2 additions and 1 deletions

View File

@ -66,7 +66,8 @@ module.exports = React.createClass({
},
onRoomStateEvents: function(ev) {
if (ev.getRoomId() !== this.props.room.roomId ||
if (!this.props.room ||
ev.getRoomId() !== this.props.room.roomId ||
ev.getType() !== 'm.room.avatar'
) return;