]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix edge case handling when 'names' is not there
authorTareq Al-Ahdal <tareqoalahdal@gmail.com>
Fri, 25 Mar 2022 14:25:55 +0000 (22:25 +0800)
committerTareq Al-Ahdal <tareqoalahdal@gmail.com>
Fri, 25 Mar 2022 14:25:55 +0000 (22:25 +0800)
nominatim/tools/country_info.py

index ef79a55afa290a8871e3120285b5363a3016f7cc..18266cce1c9f5fe59f69c9c880c2f21ccd52b705 100644 (file)
@@ -35,8 +35,8 @@ class _CountryInfo:
                 elif not isinstance(prop['languages'], list):
                     prop['languages'] = [x.strip()
                                          for x in prop['languages'].split(',')]
-                if 'names' not in prop:
-                    prop['names'][self._key_prefix] = {}
+                if 'names' not in prop or prop['names'] is None:
+                    prop['names'] = {self._key_prefix: {}}
 
     def items(self):
         """ Return tuples of (country_code, property dict) as iterable.