Skip to content

Commit 937d09a

Browse files
authored
fix(ui): added optional chaining to getContentType to prevent undefin… (#6990)
1 parent 94e25f7 commit 937d09a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

frontend/common/utils/utils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ const Utils = Object.assign({}, BaseUtils, {
221221
flagsmithFeatureExists(flag: string) {
222222
return Object.prototype.hasOwnProperty.call(flagsmith.getAllFlags(), flag)
223223
},
224-
getContentType(contentTypes: ContentType[], model: string, type: string) {
225-
return contentTypes.find((c: ContentType) => c[model] === type) || null
224+
getContentType(contentTypes: ContentType[] | undefined, model: string, type: string) {
225+
return contentTypes?.find((c: ContentType) => c[model] === type) || null
226226
},
227227
getCreateProjectPermission(organisation: Organisation) {
228228
if (organisation?.restrict_project_create_to_admin) {

0 commit comments

Comments
 (0)