Fix bug when generating a key when get_room_events_stream returned zero rows

paul/schema_breaking_changes
Erik Johnston 2014-08-15 16:05:46 +01:00
parent 86be66c34e
commit cd2967d271
1 changed files with 7 additions and 3 deletions

View File

@ -89,10 +89,14 @@ class StreamStore(SQLBaseStore):
ret = [self._parse_event_from_row(r) for r in rows]
if from_key < to_key:
key = max([r["ordering"] for r in rows])
if rows:
if from_key < to_key:
key = max([r["ordering"] for r in rows])
else:
key = min([r["ordering"] for r in rows])
else:
key = min([r["ordering"] for r in rows])
key = to_key
defer.returnValue((ret, key))