Skip to content

Commit

Permalink
fix: check if field exists when generating defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Aug 20, 2022
1 parent d5afa3c commit 37f686c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ export default class ObjectSchema<
let dft: any = {};
this._nodes.forEach((key) => {
const field = this.fields[key] as any;
dft[key] = 'getDefault' in field ? field.getDefault() : undefined;
dft[key] =
field && 'getDefault' in field ? field.getDefault() : undefined;
});

return dft;
Expand Down

0 comments on commit 37f686c

Please sign in to comment.