Skip to content

Commit

Permalink
prevent crash when login is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Oct 20, 2023
1 parent 1fa4923 commit dab6cbd
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 dab6cbd

Please sign in to comment.