From 10e5caa76645c0476cb0220314f63d6d84f64283 Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
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 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;
 	}