summary refs log tree commit diff
path: root/synapse/handlers/room_list.py
diff options
context:
space:
mode:
authorNeil Johnson <neil@fragile.org.uk>2018-01-26 00:12:02 +0000
committerNeil Johnson <neil@fragile.org.uk>2018-01-26 00:12:02 +0000
commit86c4f49a31fe044a727c64e40009596050cdab95 (patch)
treee1649e67f6c4d1b968fea9950ce7482ff9e21bca /synapse/handlers/room_list.py
parentfix return type, should be a dict (diff)
downloadsynapse-86c4f49a31fe044a727c64e40009596050cdab95.tar.xz
rather than try reconstruct the results object, better to guard against the xrange step argument being 0
Diffstat (limited to 'synapse/handlers/room_list.py')
-rw-r--r--synapse/handlers/room_list.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py
index 2ee63548ca..cf62ead816 100644
--- a/synapse/handlers/room_list.py
+++ b/synapse/handlers/room_list.py
@@ -186,10 +186,6 @@ class RoomListHandler(BaseHandler):
         logger.info("After sorting and filtering, %i rooms remain",
                     len(rooms_to_scan))
 
-        # bail if no rooms to work on
-        if len(rooms_to_scan) == 0:
-            defer.returnValue({})
-
         # _append_room_entry_to_chunk will append to chunk but will stop if
         # len(chunk) > limit
         #
@@ -207,8 +203,8 @@ class RoomListHandler(BaseHandler):
         if limit:
             step = limit + 1
         else:
-            step = len(rooms_to_scan)
-
+            # step cannot be zero
+            step = len(rooms_to_scan) if len(rooms_to_scan) != 0 else 1
         chunk = []
         for i in xrange(0, len(rooms_to_scan), step):
             batch = rooms_to_scan[i:i + step]