#each should handle undefined or null values

This commit is contained in:
wycats
2010-12-21 09:46:22 -08:00
parent fc0d721b96
commit e0246d7dfc
+1 -1
View File
@@ -81,7 +81,7 @@ Handlebars.registerHelper('blockHelperMissing', function(context, fn, inverse) {
Handlebars.registerHelper('each', function(context, fn, inverse) {
var ret = "";
if(context.length > 0) {
if(context && context.length > 0) {
for(var i=0, j=context.length; i<j; i++) {
ret = ret + fn(context[i]);
}