Skip to content

Commit 32cd74b

Browse files
committed
Fix crash when shortAnswer is deactivated and input type is not recognized
1 parent df3e7d0 commit 32cd74b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/formBuilder/utils.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ export function getCardBody(
4343
category: string,
4444
allFormInputs: { [string]: FormInput },
4545
) {
46-
return allFormInputs[category].cardBody;
46+
return (
47+
(allFormInputs[category] && allFormInputs[category].cardBody) ||
48+
(() => null)
49+
);
4750
}
4851
export function categoryToNameMap(
4952
category: string,
@@ -833,7 +836,10 @@ export function getCardParameterInputComponentForType(
833836
category: string,
834837
allFormInputs: { [string]: FormInput },
835838
) {
836-
return allFormInputs[category].modalBody || (() => null);
839+
return (
840+
(allFormInputs[category] && allFormInputs[category].modalBody) ||
841+
(() => null)
842+
);
837843
}
838844

839845
// takes in an array of Card Objects and updates both schemas

0 commit comments

Comments
 (0)