diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index b03115ffb62f..c7c1dd4ba697 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1095,7 +1095,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco // STEP 2: Get existing IOU/Expense report and update its total OR build a new optimistic one // For Control policy expense chats, if the report is already approved, create a new expense report - let oneOnOneIOUReport = lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${oneOnOneChatReport.iouReportID}`, undefined); + let oneOnOneIOUReport = oneOnOneChatReport.iouReportID ? lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${oneOnOneChatReport.iouReportID}`, undefined) : undefined; const shouldCreateNewOneOnOneIOUReport = _.isUndefined(oneOnOneIOUReport) || (isOwnPolicyExpenseChat && ReportUtils.isControlPolicyExpenseReport(oneOnOneIOUReport) && ReportUtils.isReportApproved(oneOnOneIOUReport)); @@ -1637,7 +1637,7 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi oneOnOneChatReport = existingChatReport || ReportUtils.buildOptimisticChatReport([participant.accountID]); } - let oneOnOneIOUReport = lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${oneOnOneChatReport.iouReportID}`, undefined); + let oneOnOneIOUReport = oneOnOneChatReport.iouReportID ? lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${oneOnOneChatReport.iouReportID}`, undefined) : undefined; const shouldCreateNewOneOnOneIOUReport = _.isUndefined(oneOnOneIOUReport) || (isPolicyExpenseChat && ReportUtils.isControlPolicyExpenseReport(oneOnOneIOUReport) && ReportUtils.isReportApproved(oneOnOneIOUReport)); diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index b310687e9fbc..22a1bc5441e6 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -467,6 +467,9 @@ function reportActionsExist(reportID) { * @param {Array} participantAccountIDList The list of accountIDs that are included in a new chat, not including the user creating it */ function openReport(reportID, participantLoginList = [], newReportObject = {}, parentReportActionID = '0', isFromDeepLink = false, participantAccountIDList = []) { + if (!reportID) { + return; + } const optimisticReportData = [ { onyxMethod: Onyx.METHOD.MERGE,