Fix panic when country code is not in db.

This commit is contained in:
Kira
2025-12-30 01:27:40 +01:00
committed by Nyanraltotlapun
parent d5193a17ec
commit 0311c41422
+3 -2
View File
@@ -213,11 +213,12 @@ def main():
if recursion_depth > 12: if recursion_depth > 12:
sys.exit("Recursion should be less than or equal 12! You doing something stupid here.") sys.exit("Recursion should be less than or equal 12! You doing something stupid here.")
result = set(NEAR_COUNTRIES[search_country])
result = set(NEAR_COUNTRIES.get(search_country,[]))
for i in range(1, recursion_depth, 1): for i in range(1, recursion_depth, 1):
n_c = list(result) n_c = list(result)
for country in n_c: for country in n_c:
result.update(NEAR_COUNTRIES[country]) result.update(NEAR_COUNTRIES.get(country,[]))
list_result = list(result) list_result = list(result)
list_result.sort() list_result.sort()