forked from mystiq/hydrogen-web
fix crash when state is not set (erroneously?) on gap response
this seems to happen when the only event in the room is a m.room.create
This commit is contained in:
parent
34ec96c1b8
commit
1fe496eeea
1 changed files with 3 additions and 2 deletions
|
@ -142,8 +142,9 @@ export class GapWriter {
|
||||||
return RoomMember.fromReplacingMemberEvent(this._roomId, event)?.serialize();
|
return RoomMember.fromReplacingMemberEvent(this._roomId, event)?.serialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// assuming the member hasn't changed within the chunk, just take it from state if it's there
|
// assuming the member hasn't changed within the chunk, just take it from state if it's there.
|
||||||
const stateMemberEvent = state.find(isOurUser);
|
// Don't assume state is set though, as it can be empty at the top of the timeline in some circumstances
|
||||||
|
const stateMemberEvent = state?.find(isOurUser);
|
||||||
if (stateMemberEvent) {
|
if (stateMemberEvent) {
|
||||||
return RoomMember.fromMemberEvent(this._roomId, stateMemberEvent)?.serialize();
|
return RoomMember.fromMemberEvent(this._roomId, stateMemberEvent)?.serialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue