From d2756b2bf212750e09043fa3e279d1d504cc00cc Mon Sep 17 00:00:00 2001 From: Sahil Date: Thu, 19 Mar 2026 14:27:42 +0530 Subject: [PATCH] fix(ui): added optional chaining to getContentType to prevent undefined crash LiveReview Pre-Commit Check: ran (iter:1, coverage:0%) --- frontend/common/utils/utils.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/common/utils/utils.tsx b/frontend/common/utils/utils.tsx index 88389946f1a4..8f1346add322 100644 --- a/frontend/common/utils/utils.tsx +++ b/frontend/common/utils/utils.tsx @@ -227,8 +227,8 @@ const Utils = Object.assign({}, require('./base/_utils'), { flagsmithFeatureExists(flag: string) { return Object.prototype.hasOwnProperty.call(flagsmith.getAllFlags(), flag) }, - getContentType(contentTypes: ContentType[], model: string, type: string) { - return contentTypes.find((c: ContentType) => c[model] === type) || null + getContentType(contentTypes: ContentType[] | undefined, model: string, type: string) { + return contentTypes?.find((c: ContentType) => c[model] === type) || null }, getCreateProjectPermission(organisation: Organisation) { if (organisation?.restrict_project_create_to_admin) {