Skip to content

Commit aff0288

Browse files
committed
Don't fail if an event doesn't belong to a room.
Signed-off-by: Travis Ralston <travpc@gmail.com>
1 parent 965a25b commit aff0288

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/components/views/rooms/PinnedEventsPanel.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,16 @@ module.exports = React.createClass({
120120
pinnedEvents.getContent().pinned.map(eventId => {
121121
promises.push(cli.getEventTimeline(this.props.room.getUnfilteredTimelineSet(), eventId, 0).then(timeline => {
122122
return {eventId, timeline};
123+
}).catch(err => {
124+
console.error("Error looking up pinned event " + eventId + " in room " + this.props.room.roomId);
125+
console.error(err);
126+
return null; // return lack of context to avoid unhandled errors
123127
}));
124128
});
125129

126130
Promise.all(promises).then(contexts => {
127-
this.setState({ loading: false, pinned: contexts });
131+
// Filter out the contexts that may have failed early by doing a truthy test
132+
this.setState({ loading: false, pinned: contexts.filter(c => c) });
128133
});
129134
}
130135
},

0 commit comments

Comments
 (0)