Skip to content

Commit

Permalink
Merge pull request #30102 from Expensify/cmartins-fixSplitBillCrash
Browse files Browse the repository at this point in the history
[CP Stag] Prevent crash when login is undefined
  • Loading branch information
puneetlath authored Oct 20, 2023
2 parents fba87cd + dab6cbd commit 4d86a99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,8 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(participant);

// In case the participant is a workspace, email & accountID should remain undefined and won't be used in the rest of this code
const email = isOwnPolicyExpenseChat || isPolicyExpenseChat ? '' : OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login).toLowerCase();
// participant.login is undefined when the request is initiated from a group DM with an unknown user, so we need to add a default
const email = isOwnPolicyExpenseChat || isPolicyExpenseChat ? '' : OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login || '').toLowerCase();
const accountID = isOwnPolicyExpenseChat || isPolicyExpenseChat ? 0 : Number(participant.accountID);
if (email === currentUserEmailForIOUSplit) {
return;
Expand Down

0 comments on commit 4d86a99

Please sign in to comment.