mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +03:00
Don't fail if an event doesn't belong to a room.
Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
parent
965a25ba84
commit
aff02885de
1 changed files with 6 additions and 1 deletions
|
@ -120,11 +120,16 @@ module.exports = React.createClass({
|
|||
pinnedEvents.getContent().pinned.map(eventId => {
|
||||
promises.push(cli.getEventTimeline(this.props.room.getUnfilteredTimelineSet(), eventId, 0).then(timeline => {
|
||||
return {eventId, timeline};
|
||||
}).catch(err => {
|
||||
console.error("Error looking up pinned event " + eventId + " in room " + this.props.room.roomId);
|
||||
console.error(err);
|
||||
return null; // return lack of context to avoid unhandled errors
|
||||
}));
|
||||
});
|
||||
|
||||
Promise.all(promises).then(contexts => {
|
||||
this.setState({ loading: false, pinned: contexts });
|
||||
// Filter out the contexts that may have failed early by doing a truthy test
|
||||
this.setState({ loading: false, pinned: contexts.filter(c => c) });
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue