From ae6e1166ab85a9fbad3d73f4925aa2e146906748 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 12 Dec 2024 15:59:06 -0700 Subject: [PATCH] fix crash --- src/libs/SearchUIUtils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 630d60bb0e08..2a3d5bc692f1 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -257,6 +257,11 @@ function getAction(data: OnyxTypes.SearchResults['data'], key: string): SearchTr const transaction = isTransaction ? data[key] : undefined; const report = isTransaction ? data[`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`] : data[key]; + // Tracked and unreported expenses don't have a report, so we return early. + if (!report) { + return CONST.SEARCH.ACTION_TYPES.VIEW; + } + // We need to check both options for a falsy value since the transaction might not have an error but the report associated with it might // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (transaction?.hasError || report.hasError) {