diff --git a/lib/marked.js b/lib/marked.js index 03251f3c58..e6f8804e28 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -1144,6 +1144,14 @@ function merge(obj) { */ function marked(src, opt, callback) { + // throw error in case of non string input + if (typeof src == 'undefined' || src === null) + throw new Error('marked(): input parameter is undefined or null'); + if (typeof src != 'string') + throw new Error('marked(): input parameter is of type ' + + Object.prototype.toString.call(src) + ', string expected'); + + if (callback || typeof opt === 'function') { if (!callback) { callback = opt;