Default to no read pins if there is no applicable account data

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-11-07 11:14:27 -07:00
parent e14e0bf200
commit e0ddd88ec9

View file

@ -75,7 +75,7 @@ module.exports = React.createClass({
const pinnedEvents = this.props.room.currentState.getStateEvents("m.room.pinned_events", ""); const pinnedEvents = this.props.room.currentState.getStateEvents("m.room.pinned_events", "");
if (!pinnedEvents) return; // nothing to read if (!pinnedEvents) return; // nothing to read
let readStateEvents = null; let readStateEvents = [];
const readPinsEvent = this.props.room.getAccountData("im.vector.room.read_pins"); const readPinsEvent = this.props.room.getAccountData("im.vector.room.read_pins");
if (readPinsEvent && readPinsEvent.getContent()) { if (readPinsEvent && readPinsEvent.getContent()) {
readStateEvents = readPinsEvent.getContent().event_ids || []; readStateEvents = readPinsEvent.getContent().event_ids || [];