diff --git a/.changeset/fix-crashing-maps.md b/.changeset/fix-crashing-maps.md
new file mode 100644
index 000000000..9cd6dfb53
--- /dev/null
+++ b/.changeset/fix-crashing-maps.md
@@ -0,0 +1,5 @@
+---
+default: patch
+---
+
+Fix Maps that contain incorrect numbers for lat/lon crashing sable
diff --git a/src/app/components/message/MsgTypeRenderers.tsx b/src/app/components/message/MsgTypeRenderers.tsx
index f06956655..5f6cbeefd 100644
--- a/src/app/components/message/MsgTypeRenderers.tsx
+++ b/src/app/components/message/MsgTypeRenderers.tsx
@@ -44,6 +44,7 @@ import 'leaflet/dist/leaflet.css';
import * as css from './MsgTypeRenderers.css';
import { markerIcon } from '$features/room/location-modal/LocationDialog';
+import { isNumber } from 'matrix-js-sdk/lib/utils';
export interface BundleContent extends IPreviewUrlResponse {
matched_url: string;
@@ -705,6 +706,7 @@ export function MLocation({ content, showMaps }: MLocationProps) {
}
const location = parseGeoUri(geoUri);
if (!location) return ;
+ const isValid = isNumber(Number(location.latitude)) && isNumber(Number(location.longitude));
const coords: LatLngExpression = [Number(location.latitude), Number(location.longitude)];
return (
@@ -733,18 +735,23 @@ export function MLocation({ content, showMaps }: MLocationProps) {
Open Location
- {showMaps && (
+ {showMaps && isValid && (