Fix error with search results because of namedetails suddenly being null

pull/219/head
Candid Dauth 2023-09-13 15:15:24 +02:00
rodzic 06493182d4
commit 99f23af11a
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -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<Record<string, string>>;
geojson: Geometry;
extratags: Record<string, string>;
namedetails: Record<string, string>;
namedetails: Record<string, string> | 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;