Skip to content

Commit

Permalink
fix(core/forms): add null check before reset value
Browse files Browse the repository at this point in the history
  • Loading branch information
sara-gnucoop committed Feb 13, 2023
1 parent 13ac67e commit 7b64348
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions projects/core/forms/src/form-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,9 @@ const updateVisibilityMapEntry = (
if (s && !s.closed) {
s.unsubscribe();
}
fg.controls[completeName].setValue(null);
if (fg.controls != null && fg.controls[completeName] != null) {
fg.controls[completeName].setValue(null);
}
});
}
if (isField) {
Expand All @@ -1486,7 +1488,7 @@ const updateVisibilityMapEntry = (
} else if (visibilityChanged && nodeInstance.visible && isField) {
const fg = formGroup.getValue();
const res = updateFormula(nodeInstance, newFormValue);
if (fg != null && res.changed) {
if (fg != null && res.changed && fg.controls != null && fg.controls[completeName] != null) {
fg.controls[completeName].setValue(res.value);
}
}
Expand Down

0 comments on commit 7b64348

Please sign in to comment.