Don't assume we have a valid event.

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-11-03 18:18:09 -06:00
parent 3656fdb571
commit 5c37155730

View file

@ -156,8 +156,8 @@ module.exports = React.createClass({
} }
const readPinsEvent = this.props.room.getAccountData("im.vector.room.read_pins"); const readPinsEvent = this.props.room.getAccountData("im.vector.room.read_pins");
if (readPinsEvent) { if (readPinsEvent && readPinsEvent.getContent()) {
const readStateEvents = readPinsEvent.getContent().event_ids; const readStateEvents = readPinsEvent.getContent().event_ids || [];
if (readStateEvents) { if (readStateEvents) {
return !readStateEvents.includes(currentPinEvent.getId()); return !readStateEvents.includes(currentPinEvent.getId());
} }