From fc2ef703dacec8a9df995c89e863eab5562656ed Mon Sep 17 00:00:00 2001 From: Shea Date: Thu, 23 Jul 2026 17:47:25 +0300 Subject: [PATCH] fix maps Signed-off-by: Shea --- .changeset/fix-crashing-maps.md | 5 +++++ src/app/components/message/MsgTypeRenderers.tsx | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/fix-crashing-maps.md 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 && (