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

Commit

Permalink
Make sure prev_ids defaults to empty list
Browse files Browse the repository at this point in the history
While this change seems a bit strange, I was seeing TypeErrors on my
homeserver because someone is sending device lists where they explicitly
set `"prev_id": null` which causes the next list comprehension to fail.

Signed-off-by: Carl Bordum Hansen <carl@bordum.dk>
  • Loading branch information
carlbordum committed May 21, 2022
1 parent 39dee30 commit 03df9cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion synapse/handlers/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ async def incoming_device_list_update(
user_id = edu_content.pop("user_id")
device_id = edu_content.pop("device_id")
stream_id = str(edu_content.pop("stream_id")) # They may come as ints
prev_ids = edu_content.pop("prev_id", [])
prev_ids = edu_content.pop("prev_id") or []
prev_ids = [str(p) for p in prev_ids] # They may come as ints

if get_domain_from_id(user_id) != origin:
Expand Down

0 comments on commit 03df9cf

Please sign in to comment.