diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 24872b5d90eb..7740c6aadcc3 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -699,7 +699,7 @@ function getPolicyIDFromSearchQuery(queryJSON: SearchQueryJSON) { function getDisplayValue(filterName: string, filter: string, personalDetails: OnyxTypes.PersonalDetailsList, cardList: OnyxTypes.CardList, reports: OnyxCollection) { if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM || filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TO) { - return PersonalDetailsUtils.createDisplayName(personalDetails[filter]?.login ?? '', personalDetails[filter]); + return PersonalDetailsUtils.createDisplayName(personalDetails?.[filter]?.login ?? '', personalDetails?.[filter]); } if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID) { return cardList[filter].bank;