Skip to content

Commit

Permalink
Fix invite processing on Element-R (#3121)
Browse files Browse the repository at this point in the history
Currently, whenever we receive an invite on element R, it crashes the sync
loop. A quick fix to make it not do that.
  • Loading branch information
richvdh committed Feb 3, 2023
1 parent 8f5db46 commit 44d2e47
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1254,11 +1254,12 @@ export class SyncApi {

const inviter = room.currentState.getStateEvents(EventType.RoomMember, client.getUserId()!)?.getSender();

if (client.isCryptoEnabled()) {
const parkedHistory = await client.crypto!.cryptoStore.takeParkedSharedHistory(room.roomId);
const crypto = client.crypto;
if (crypto) {
const parkedHistory = await crypto.cryptoStore.takeParkedSharedHistory(room.roomId);
for (const parked of parkedHistory) {
if (parked.senderId === inviter) {
await client.crypto!.olmDevice.addInboundGroupSession(
await crypto.olmDevice.addInboundGroupSession(
room.roomId,
parked.senderKey,
parked.forwardingCurve25519KeyChain,
Expand Down

0 comments on commit 44d2e47

Please sign in to comment.