From 99f23af11af2854d45658072e13373a119e1a069 Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Wed, 13 Sep 2023 15:15:24 +0200 Subject: [PATCH] Fix error with search results because of namedetails suddenly being null --- server/src/search.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/search.ts b/server/src/search.ts index d9856ded..f55ad066 100644 --- a/server/src/search.ts +++ b/server/src/search.ts @@ -20,6 +20,7 @@ interface NominatimResult { lat: string; lon: string; zoom?: number; + name: string; display_name: string; place_rank: number; category: string; @@ -29,7 +30,7 @@ interface NominatimResult { address: Partial>; geojson: Geometry; extratags: Record; - namedetails: Record; + namedetails: Record | null; elevation?: number; // Added by us } @@ -230,7 +231,7 @@ function _formatAddress(result: NominatimResult) { // address notation guidelines let type = result.type; - let name = result.namedetails.name; + let name = result.namedetails?.name ?? result.name; const countryCode = result.address.country_code; let road = result.address.road;