don't crash on missing room members

This commit is contained in:
Matthew Hodgson 2018-03-16 01:21:46 +00:00
parent 8f0cd4ffbc
commit b68da579f0

View file

@ -72,6 +72,7 @@ export default class UserProvider extends AutocompleteProvider {
// updates from pagination will happen when the paginate completes. // updates from pagination will happen when the paginate completes.
if (toStartOfTimeline || !data || !data.liveEvent) return; if (toStartOfTimeline || !data || !data.liveEvent) return;
// TODO: lazyload if we have no ev.sender room member?
this.onUserSpoke(ev.sender); this.onUserSpoke(ev.sender);
} }
@ -147,6 +148,7 @@ export default class UserProvider extends AutocompleteProvider {
onUserSpoke(user: RoomMember) { onUserSpoke(user: RoomMember) {
if (this.users === null) return; if (this.users === null) return;
if (!user) return;
if (user.userId === MatrixClientPeg.get().credentials.userId) return; if (user.userId === MatrixClientPeg.get().credentials.userId) return;
// Move the user that spoke to the front of the array // Move the user that spoke to the front of the array