summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-08-28 16:14:00 +0100
committerOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-08-28 16:14:00 +0100
commit73d552a05d68b2895b796ca95def75778cd00cc2 (patch)
tree05cacd1821c4f79b107467a50cb5b880d5973f1b
parentTrack new users in user statistics. (diff)
downloadsynapse-73d552a05d68b2895b796ca95def75778cd00cc2.tar.xz
Hoist up None check to prevent trying to iterate over NoneType.keys()
-rw-r--r--synapse/storage/stats.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/storage/stats.py b/synapse/storage/stats.py
index 3df57b52ea..3433eef288 100644
--- a/synapse/storage/stats.py
+++ b/synapse/storage/stats.py
@@ -258,6 +258,10 @@ class StatsStore(StateDeltasStore):
                 (i.e. not deltas) of absolute fields.
                 Does not work with per-slice fields.
         """
+
+        if absolute_field_overrides is None:
+            absolute_field_overrides = {}
+
         table, id_col = TYPE_TO_TABLE[stats_type]
 
         quantised_ts = self.quantise_stats_time(int(ts))
@@ -288,9 +292,6 @@ class StatsStore(StateDeltasStore):
             if key not in absolute_field_overrides
         }
 
-        if absolute_field_overrides is None:
-            absolute_field_overrides = {}
-
         if complete_with_stream_id is not None:
             absolute_field_overrides = absolute_field_overrides.copy()
             absolute_field_overrides[