From 49f140ce47c817184cfd3fee54959d7418b02dc0 Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Fri, 13 Jan 2017 10:56:00 -0500 Subject: [PATCH] Fix crash if emojify string is null or undefined --- lib/emoji.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/emoji.js b/lib/emoji.js index 17af40e..8141f07 100644 --- a/lib/emoji.js +++ b/lib/emoji.js @@ -80,6 +80,8 @@ Emoji.which = function which(emoji_code) { * @return {string} */ Emoji.emojify = function emojify(str, on_missing) { + if (!str) return ''; + return str.split(parser) // parse emoji via regex .map(function parseEmoji(s, i) { // every second element is an emoji, e.g. "test :fast_forward:" -> [ "test ", "fast_forward" ]