summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--synapse/appservice/api.py12
-rw-r--r--synapse/handlers/appservice.py14
2 files changed, 15 insertions, 11 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py
index cc4af23962..afc64ed267 100644
--- a/synapse/appservice/api.py
+++ b/synapse/appservice/api.py
@@ -162,11 +162,19 @@ class ApplicationServiceApi(SimpleHttpClient):
                 urllib.quote(protocol)
             )
             try:
-                defer.returnValue((yield self.get_json(uri, {})))
+                info = yield self.get_json(uri, {})
+
+                # Ignore any result that doesn't contain an "instances" list
+                if "instances" not in info:
+                    defer.returnValue(None)
+                if not isinstance(info["instances"], list):
+                    defer.returnValue(None)
+
+                defer.returnValue(info)
             except Exception as ex:
                 logger.warning("query_3pe_protocol to %s threw exception %s",
                                uri, ex)
-                defer.returnValue({})
+                defer.returnValue(None)
 
         key = (service.id, protocol)
         return self.protocol_meta_cache.get(key) or (
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py
index 4648e78d47..88fa0bb2e4 100644
--- a/synapse/handlers/appservice.py
+++ b/synapse/handlers/appservice.py
@@ -186,17 +186,13 @@ class ApplicationServicesHandler(object):
                 if only_protocol is not None and p != only_protocol:
                     continue
 
-                info = yield self.appservice_api.get_3pe_protocol(s, p)
-
-                # Ignore any result that doesn't contain an "instances" list
-                if "instances" not in info:
-                    continue
-                if not isinstance(info["instances"], list):
-                    continue
-
                 if p not in protocols:
                     protocols[p] = []
-                protocols[p].append(info)
+
+                info = yield self.appservice_api.get_3pe_protocol(s, p)
+
+                if info is not None:
+                    protocols[p].append(info)
 
         def _merge_instances(infos):
             if not infos: