Fix: NoneType.upper() Fehler bei country_code=None im Geoparsing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dieser Commit ist enthalten in:
claude-dev
2026-03-07 22:21:00 +01:00
Ursprung 5ae61a1379
Commit 29dc457ceb

Datei anzeigen

@@ -60,7 +60,7 @@ def _geocode_offline(name: str, country_code: str = "") -> Optional[dict]:
if matches:
# Disambiguierung: country_code bevorzugen, dann Population
if country_code:
cc_matches = [c for c in matches if c.get("countrycode", "").upper() == country_code.upper()]
cc_matches = [c for c in matches if c.get("countrycode", "").upper() == (country_code or "").upper()]
if cc_matches:
matches = cc_matches
best = max(matches, key=lambda c: c.get("population", 0))
@@ -95,7 +95,7 @@ def _geocode_location(name: str, country_code: str = "", haiku_coords: Optional[
country_code: ISO-2 Code (von Haiku)
haiku_coords: {"lat": float, "lon": float} (Fallback von Haiku)
"""
cache_key = f"{name.lower().strip()}|{country_code.upper()}"
cache_key = f"{name.lower().strip()}|{(country_code or '').upper()}"
if cache_key in _geocode_cache:
return _geocode_cache[cache_key]