Skip to content

Commit 7b14c4b

Browse files
Fatimahslint
authored andcommitted
custom fields: added check for unfilled fields
1 parent e3306a6 commit 7b14c4b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib/forms/widgets/custom_fields/ComposeFields.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ export class ComposeFields extends Component {
1010
constructor(props) {
1111
super(props);
1212
const { composeSections, record } = props;
13-
const filled = Object.keys(record.custom_fields).map(
14-
(key) => `custom_fields.${key}`
15-
);
13+
const filled =
14+
record.custom_fields && typeof record.custom_fields === "object"
15+
? Object.keys(record.custom_fields).map((key) => `custom_fields.${key}`)
16+
: [];
1617
this.state = { sections: composeSections, tempFields: [], recordFields: filled };
1718
this.fieldsCfg = this.getFieldsConfig(composeSections);
1819
this.sectionsList = composeSections.map((section) => section.section);

0 commit comments

Comments
 (0)