mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
don't break on empty room sync response
This commit is contained in:
parent
8a39c16a38
commit
061e7abd50
@ -191,8 +191,9 @@ export class Room extends EventEmitter {
|
||||
|
||||
let decryptPreparation;
|
||||
if (roomEncryption) {
|
||||
const events = roomResponse?.timeline?.events;
|
||||
if (Array.isArray(events)) {
|
||||
// also look for events in timeline here
|
||||
let events = roomResponse?.timeline?.events || [];
|
||||
if (events.length) {
|
||||
const eventsToDecrypt = events.filter(event => {
|
||||
return event?.type === EVENT_ENCRYPTED_TYPE;
|
||||
});
|
||||
|
@ -167,7 +167,7 @@ export class SyncWriter {
|
||||
}
|
||||
|
||||
async _writeTimeline(entries, timeline, currentKey, memberChanges, txn, log) {
|
||||
if (Array.isArray(timeline.events) && timeline.events.length) {
|
||||
if (Array.isArray(timeline?.events) && timeline.events.length) {
|
||||
// only create a fragment when we will really write an event
|
||||
currentKey = await this._ensureLiveFragment(currentKey, entries, timeline, txn, log);
|
||||
const events = deduplicateEvents(timeline.events);
|
||||
|
Loading…
Reference in New Issue
Block a user