From 0e191f11d0b410d147a7501508030c77fe1b5efe Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 24 Mar 2020 03:56:31 -0400 Subject: [PATCH] Member ev. processing: don't assume any key exists --- src/backend/nio_callbacks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/nio_callbacks.py b/src/backend/nio_callbacks.py index f3565c1c..be3ca300 100644 --- a/src/backend/nio_callbacks.py +++ b/src/backend/nio_callbacks.py @@ -269,13 +269,13 @@ class NioCallbacks: # Profile changes changed = [] - if prev and now["avatar_url"] != prev["avatar_url"]: + if prev and now.get("avatar_url") != prev.get("avatar_url"): changed.append("profile picture") # TODO: s - if prev and now["displayname"] != prev["displayname"]: + if prev and now.get("displayname") != prev.get("displayname"): changed.append('display name from "{}" to "{}"'.format( - prev["displayname"] or ev.state_key, - now["displayname"] or ev.state_key, + prev.get("displayname") or ev.state_key, + now.get("displayname") or ev.state_key, )) if changed: @@ -285,8 +285,8 @@ class NioCallbacks: if account.profile_updated < ev_date: account.profile_updated = ev_date - account.display_name = now["displayname"] or "" - account.avatar_url = now["avatar_url"] or "" + account.display_name = now.get("displayname") or "" + account.avatar_url = now.get("avatar_url") or "" if self.client.backend.ui_settings["hideProfileChangeEvents"]: self.client.skipped_events[room.room_id] += 1