From 94cfd590fe8310ea40707a5e2527503940e80686 Mon Sep 17 00:00:00 2001 From: cel Date: Thu, 9 Mar 2017 22:18:19 -0500 Subject: More robust text handling --- lib/render.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/render.js b/lib/render.js index cde359d..ed8cb1a 100644 --- a/lib/render.js +++ b/lib/render.js @@ -81,6 +81,7 @@ Render.prototype.emoji = function (emoji) { } Render.prototype.markdown = function (text, mentions) { + if (!text) return '' var mentionsObj = this._mentions = {} if (Array.isArray(mentions)) mentions.forEach(function (link) { if (!link) return @@ -89,7 +90,7 @@ Render.prototype.markdown = function (text, mentions) { else if (link.host === 'http://localhost:7777') mentionsObj[link.href] = link.link }) - var out = marked((text || '').toString(), this.markedOpts) + var out = marked(String(text), this.markedOpts) delete this._mentions return out } -- cgit v1.2.3