summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@arasphere.net>2019-01-02 23:37:39 +0000
committerRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-01-02 23:37:39 +0000
commit27128145e67b2c00ff84e7f3d6ca56b03616648b (patch)
tree182c7cd50b29836d8ac67a76f5aaca4db1aa4503 /synapse/handlers
parentUpdate README to not lie about required restart (#4343) (diff)
downloadsynapse-27128145e67b2c00ff84e7f3d6ca56b03616648b.tar.xz
fix NPE in /messages by checking if all events were filtered out (#4330)
Diffstat (limited to '')
-rw-r--r--synapse/handlers/pagination.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/synapse/handlers/pagination.py b/synapse/handlers/pagination.py
index 43f81bd607..9d257ecf31 100644
--- a/synapse/handlers/pagination.py
+++ b/synapse/handlers/pagination.py
@@ -235,6 +235,17 @@ class PaginationHandler(object):
                 "room_key", next_key
             )
 
+        if events:
+            if event_filter:
+                events = event_filter.filter(events)
+
+            events = yield filter_events_for_client(
+                self.store,
+                user_id,
+                events,
+                is_peeking=(member_event_id is None),
+            )
+
         if not events:
             defer.returnValue({
                 "chunk": [],
@@ -242,16 +253,6 @@ class PaginationHandler(object):
                 "end": next_token.to_string(),
             })
 
-        if event_filter:
-            events = event_filter.filter(events)
-
-        events = yield filter_events_for_client(
-            self.store,
-            user_id,
-            events,
-            is_peeking=(member_event_id is None),
-        )
-
         state = None
         if event_filter and event_filter.lazy_load_members():
             # TODO: remove redundant members