Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix "list index out of range" error #4937

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me it sounds like the error in #4842 was due to batch.events being an empty list, rather than None. In that case, this if statement would still run and crash.

Instead you may want to check if len(batch.events) > 0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state_at_timeline_start = yield self.store.get_state_ids_for_event(
batch.events[0].event_id, state_filter=state_filter,
)
Expand Down