summary refs log tree commit diff
path: root/synapse/handlers/user_directory.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-06-13 10:19:26 +0100
committerErik Johnston <erik@matrix.org>2017-06-13 10:19:26 +0100
commit6ae8373d40f9008ab80dd7894c4c79beb7ceca48 (patch)
tree5c0a0834f7cc77c530b7699f54ac9110b78e4eaf /synapse/handlers/user_directory.py
parentMerge pull request #2266 from matrix-org/erikj/host_in_room (diff)
downloadsynapse-6ae8373d40f9008ab80dd7894c4c79beb7ceca48.tar.xz
Don't assume existance of events when updating user directory
Diffstat (limited to 'synapse/handlers/user_directory.py')
-rw-r--r--synapse/handlers/user_directory.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py
index 02b720b654..ce5a506b74 100644
--- a/synapse/handlers/user_directory.py
+++ b/synapse/handlers/user_directory.py
@@ -225,7 +225,7 @@ class UserDirectoyHandler(object):
                         logger.debug("Server is still in room: %r", room_id)
 
                 if change:  # The user joined
-                    event = yield self.store.get_event(event_id)
+                    event = yield self.store.get_event(event_id, allow_none=True)
                     profile = ProfileInfo(
                         avatar_url=event.content.get("avatar_url"),
                         display_name=event.content.get("displayname"),
@@ -379,8 +379,11 @@ class UserDirectoyHandler(object):
         if not prev_event_id or not event_id:
             return
 
-        prev_event = yield self.store.get_event(prev_event_id)
-        event = yield self.store.get_event(event_id)
+        prev_event = yield self.store.get_event(prev_event_id, allow_none=True)
+        event = yield self.store.get_event(event_id, allow_none=True)
+
+        if not prev_event or not event:
+            return
 
         if event.membership != Membership.JOIN:
             return