Skip to content

Commit a35bd30

Browse files
committed
defensive coding for #cs-6625
1 parent f317c21 commit a35bd30

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/host/app/lib/matrix-handlers/timeline.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ async function processDecryptedEvent(context: Context, event: Event) {
5454
if (
5555
roomField &&
5656
event.type === 'm.room.message' &&
57-
event.content?.msgtype === 'org.boxel.message'
57+
event.content?.msgtype === 'org.boxel.message' &&
58+
event.content.data
5859
) {
59-
let data = JSON.parse(event.content.data) as CardMessageContent['data'];
60+
let data = (
61+
typeof event.content.data === 'string'
62+
? JSON.parse(event.content.data)
63+
: event.content.data
64+
) as CardMessageContent['data'];
6065
if (
6166
'attachedCardsEventIds' in data &&
6267
Array.isArray(data.attachedCardsEventIds)

0 commit comments

Comments
 (0)