diff --git a/src/utils/location/map.ts b/src/utils/location/map.ts index 8ba3d68c48..34d3d01478 100644 --- a/src/utils/location/map.ts +++ b/src/utils/location/map.ts @@ -24,7 +24,7 @@ import { parseGeoUri } from "./parseGeoUri"; import { findMapStyleUrl } from "./findMapStyleUrl"; import { LocationShareError } from "./LocationShareErrors"; -export const createMap = (interactive: boolean, bodyId: string, onError: (error: Error) => void): maplibregl.Map => { +export const createMap = (interactive: boolean, bodyId: string, onError?: (error: Error) => void): maplibregl.Map => { try { const styleUrl = findMapStyleUrl(); @@ -54,7 +54,7 @@ export const createMap = (interactive: boolean, bodyId: string, onError: (error: "Failed to load map: check map_style_url in config.json has a " + "valid URL and API key", e.error, ); - onError(new Error(LocationShareError.MapStyleUrlNotReachable)); + onError?.(new Error(LocationShareError.MapStyleUrlNotReachable)); }); return map;