diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-07-01 13:46:34 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-07-01 13:46:34 +0900 |
| commit | 10e5caa76645c0476cb0220314f63d6d84f64283 (patch) | |
| tree | 613c8be415c413411515619565a263955b51048c /src | |
| parent | Improve error message (diff) | |
| download | sharkey-10e5caa76645c0476cb0220314f63d6d84f64283.tar.gz sharkey-10e5caa76645c0476cb0220314f63d6d84f64283.tar.bz2 sharkey-10e5caa76645c0476cb0220314f63d6d84f64283.zip | |
Fix bug
Diffstat (limited to 'src')
| -rw-r--r-- | src/mfm/html.ts | 4 | ||||
| -rw-r--r-- | 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 64208af88b..71b4739476 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 2b6a459b1e..8d71409e58 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; } |