Skip to content

Commit

Permalink
Fix crash if emojify string is null or undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperka committed Jan 13, 2017
1 parent 6f52401 commit 49f140c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down

0 comments on commit 49f140c

Please sign in to comment.