Skip to content

Commit

Permalink
Don't crash if there is no meta for a field
Browse files Browse the repository at this point in the history
  • Loading branch information
jasny committed May 24, 2017
1 parent c52b4ff commit 321f940
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/legalform-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,18 @@

if (keypath.length > 1) {
for (var i = 1; i < keypath.length; i++) {
if (!meta[keypath[i]]) break;
if (meta) break;

meta = meta[keypath[i]];
name += '.' + keypath[i];
}
}

if (typeof meta === 'undefined') {
console && console.warn("No meta for '" + name + "'");
return;
}

// Implement validation for numbers
if (meta.type === 'number') {
var min = $(input).attr('min');
Expand Down

0 comments on commit 321f940

Please sign in to comment.