summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2014-11-18 15:10:11 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2014-11-18 15:10:11 +0000
commit4c18e08036a15c536070ae6b9c0b314fc032010d (patch)
treeac3e77867897d24ec59f89da735542944f2e0f9d
parentInclude 'messages' snapshot in room initialSync (diff)
downloadsynapse-4c18e08036a15c536070ae6b9c0b314fc032010d.tar.xz
Don't expect all _user_cachemap entries to definitely contain a "last_active" key
-rw-r--r--synapse/handlers/presence.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index 2ccc2245b7..36d864e3f1 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -180,9 +180,9 @@ class PresenceHandler(BaseHandler):
             state["presence"] = state.pop("state")
 
             if target_user in self._user_cachemap:
-                state["last_active"] = (
-                    self._user_cachemap[target_user].get_state()["last_active"]
-                )
+                cached_state = self._user_cachemap[target_user].get_state()
+                if "last_active" in cached_state:
+                    state["last_active"] = cached_state["last_active"]
         else:
             # TODO(paul): Have remote server send us permissions set
             state = self._get_or_offline_usercache(target_user).get_state()