From baf6ccf6591cefaede8f6fcc326ee73b6bf73956 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 1 Jul 2018 13:46:34 +0900 Subject: [PATCH] Fix bug --- src/mfm/html.ts | 4 ++++ src/mfm/parse/index.ts | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mfm/html.ts b/src/mfm/html.ts index 64208af88..71b473947 100644 --- a/src/mfm/html.ts +++ b/src/mfm/html.ts @@ -92,6 +92,10 @@ const handlers: { [key: string]: (window: any, token: any, mentionedRemoteUsers: }; export default (tokens: TextElement[], mentionedRemoteUsers: INote['mentionedRemoteUsers'] = []) => { + if (tokens == null) { + return null; + } + const { window } = new JSDOM(''); for (const token of tokens) { diff --git a/src/mfm/parse/index.ts b/src/mfm/parse/index.ts index 2b6a459b1..8d71409e5 100644 --- a/src/mfm/parse/index.ts +++ b/src/mfm/parse/index.ts @@ -43,8 +43,7 @@ export type TextElement = { type: 'text', content: string } export type TextElementProcessor = (text: string, i: number) => TextElement | TextElement[]; export default (source: string): TextElement[] => { - - if (source == '') { + if (source == null || source == '') { return null; }