Skip to content

Commit

Permalink
Merge pull request #32 from cribspot/master
Browse files Browse the repository at this point in the history
Fix crash if emojify string is null
  • Loading branch information
omnidan authored Jan 15, 2017
2 parents 6f52401 + 49f140c commit fd7e55d
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 fd7e55d

Please sign in to comment.