diff --git a/Alloy/commands/compile/compilerUtils.js b/Alloy/commands/compile/compilerUtils.js index e35616545..922d1fdf1 100755 --- a/Alloy/commands/compile/compilerUtils.js +++ b/Alloy/commands/compile/compilerUtils.js @@ -1018,7 +1018,7 @@ exports.generateCollectionBindingTemplate = function(args) { code += ' if (e && e.fromAdapter) { return; }'; code += ' var opts = ' + handlerFunc + '.opts || {};'; code += ' var models = ' + whereCode + ';'; - code += ' var len = models.length;'; + code += ' var len = models ? models.length : 0;'; code += '<%= pre %>'; code += ' for (var i = 0; i < len; i++) {'; code += ' var <%= localModel %> = models[i];';