summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-04-11 09:56:54 +0100
committerErik Johnston <erik@matrix.org>2017-04-11 09:56:54 +0100
commit34840cdcef9ecdf721604934b6142040d7561816 (patch)
tree31b613b918c68047135df68457534225050aac76
parenttrust a hypothetical future riot.im IS (diff)
downloadsynapse-34840cdcef9ecdf721604934b6142040d7561816.tar.xz
Fix getting latest device IP for user with no devices
-rw-r--r--synapse/storage/client_ips.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/storage/client_ips.py b/synapse/storage/client_ips.py
index 71e5ea112f..5bed255eb2 100644
--- a/synapse/storage/client_ips.py
+++ b/synapse/storage/client_ips.py
@@ -90,6 +90,8 @@ class ClientIpStore(background_updates.BackgroundUpdateStore):
             are (user_id, device_id) tuples. The values are also dicts, with
             keys giving the column names
         """
+        if not devices:
+            defer.returnValue({})
 
         res = yield self.runInteraction(
             "get_last_client_ip_by_device",
@@ -110,6 +112,9 @@ class ClientIpStore(background_updates.BackgroundUpdateStore):
 
     @classmethod
     def _get_last_client_ip_by_device_txn(cls, txn, devices, retcols):
+        if not devices:
+            return []
+
         where_clauses = []
         bindings = []
         for (user_id, device_id) in devices: