diff --git a/src/indexing/EventIndex.js b/src/indexing/EventIndex.js index c912e31fa5..0980413eb5 100644 --- a/src/indexing/EventIndex.js +++ b/src/indexing/EventIndex.js @@ -170,7 +170,12 @@ export default class EventIndex { return; } - const e = ev.toJSON().decrypted; + const jsonEvent = ev.toJSON(); + + let e; + if (ev.isEncrypted()) e = jsonEvent.decrypted; + else e = jsonEvent; + const profile = { displayname: ev.sender.rawDisplayName, avatar_url: ev.sender.getMxcAvatarUrl(),