diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 2d471a0ca26c..807fda234c48 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1090,7 +1090,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)); @@ -1632,7 +1632,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 3f7dc76b174d..9da0f93bcb30 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -463,6 +463,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,