From e9877c87fe73da8e5cf89a732551126ee93f30eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sommer?= Date: Sat, 9 Mar 2019 07:25:18 +0100 Subject: [PATCH] handler/sync: Handle batches without events Check if the batch contains events before trying to access them. Fixes #4842 --- synapse/handlers/sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 57bb996245d5..4290c930a3f3 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -770,7 +770,7 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke current=current_state_ids, lazy_load_members=lazy_load_members, ) - elif batch.limited: + elif batch.limited and batch.events: state_at_timeline_start = yield self.store.get_state_ids_for_event( batch.events[0].event_id, state_filter=state_filter, )