From: Wolfram Schneider Date: Thu, 10 Jul 2014 11:29:26 +0000 (+0000) Subject: mkws-paragraphs: obj can be undefined X-Git-Tag: 1.0.0~389^2~2 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=e32341fa8876fbada43f2a8b38bcc8e3c06d8f33;p=mkws-moved-to-github.git mkws-paragraphs: obj can be undefined --- diff --git a/src/mkws-handlebars.js b/src/mkws-handlebars.js index ce24206..866dc8a 100644 --- a/src/mkws-handlebars.js +++ b/src/mkws-handlebars.js @@ -15,7 +15,7 @@ Handlebars.registerHelper('mkws-paragraphs', function(obj, nPara, nSent) { // {"hash":{},"data":{}} for parameters that are not provided. So we // have to be prepared for actual numbers, explicitly undefined // values and this dumb magic value. - if (nPara === undefined || nPara.hasOwnProperty('hash') || nPara == 0 || nPara > obj.length) { + if (obj && (nPara === undefined || nPara.hasOwnProperty('hash') || nPara == 0 || nPara > obj.length)) { nPara = obj.length; } if (nSent === undefined || nSent.hasOwnProperty('hash') || nSent == 0) {