From f8ac97fb22a73d8d5d8f8974357fccd0f15e06bb Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Mon, 14 Mar 2016 11:23:39 -0400
Subject: Changed mention parser to ignore empty string mentions

---
 webapp/utils/text_formatting.jsx | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'webapp/utils/text_formatting.jsx')

diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index 9833b995c..4c8b5e24c 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -213,6 +213,11 @@ function highlightCurrentMentions(text, tokens) {
     }
 
     for (const mention of UserStore.getCurrentMentionKeys()) {
+        // occasionally we get an empty mention which matches a bunch of empty strings
+        if (!mention) {
+            continue;
+        }
+
         output = output.replace(new RegExp(`(^|\\W)(${escapeRegex(mention)})\\b`, 'gi'), replaceCurrentMentionWithToken);
     }
 
-- 
cgit v1.2.3-1-g7c22

