Skip to content

Commit d62e253

Browse files
author
Bjornskjald
committed
Fixed error when XMA has no type
1 parent 24db6cf commit d62e253

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/types/attachments/XMAAttachment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface XMAAttachment extends Attachment {
2626
export interface UnavailableXMA extends XMAAttachment {
2727
type: 'UnavailableXMA'
2828
message: string
29+
attach: any
2930
}
3031
export interface StoryXMA extends XMAAttachment {
3132
type: 'StoryXMA'

src/types/attachments/parseXMAAttachment.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import vm from 'vm'
1111

1212
export default function parseXMAAttachment (attach: any) {
1313
attach = attach[Object.keys(attach)[0]].story_attachment
14-
if (!attach.target) {
14+
if (!attach.target || !attach.target.__type__) {
1515
return {
1616
type: 'UnavailableXMA',
17-
message: attach.description.text
17+
message: attach.description.text,
18+
attach
1819
} as UnavailableXMA
1920
}
2021
const type = attach.target.__type__.name

0 commit comments

Comments
 (0)