Skip to content

Commit a9fbd9b

Browse files
committed
Check if there is anything to act upon
1 parent 2488ba8 commit a9fbd9b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/directives/schema-validate.js

+6
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,16 @@ angular.module('schemaForm').directive('schemaValidate', ['sfValidator', 'sfSele
145145
obj = sfSelect(form.key.slice(0, form.key.length - 1), obj);
146146
}
147147

148+
// We can get undefined here if the form hasn't been filled out entirely
149+
if (obj === undefined) {
150+
return;
151+
}
152+
148153
// Type can also be a list in JSON Schema
149154
var type = (form.schema && form.schema.type) || '';
150155

151156
// Empty means '',{} and [] for appropriate types and undefined for the rest
157+
console.log('destroy', destroyStrategy, form.key, type, obj);
152158
if (destroyStrategy === 'empty' && type.indexOf('string') !== -1) {
153159
obj[form.key.slice(-1)] = '';
154160
} else if (destroyStrategy === 'empty' && type.indexOf('object') !== -1) {

0 commit comments

Comments
 (0)