Skip to content

Commit

Permalink
Remove undefined logins to prevent crash
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-marcellini committed Mar 31, 2023
1 parent 27dca97 commit 413dd0d
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,26 @@ function getPersonalDetailsForLogins(logins, personalDetails) {
if (!personalDetails) {
return personalDetailsForLogins;
}
_.each(logins, (login) => {
let personalDetail = personalDetails[login];
if (!personalDetail) {
personalDetail = {
login,
displayName: Str.removeSMSDomain(login),
avatar: ReportUtils.getDefaultAvatar(login),
};
}
_.chain(logins)

// Somehow it's possible for the logins coming from report.participants to contain undefined values so we use compact to remove them.
.compact()
.each(logins, (login) => {
let personalDetail = personalDetails[login];
if (!personalDetail) {
personalDetail = {
login,
displayName: Str.removeSMSDomain(login),
avatar: ReportUtils.getDefaultAvatar(login),
};
}

if (login === CONST.EMAIL.CONCIERGE) {
personalDetail.avatar = CONST.CONCIERGE_ICON_URL;
}
if (login === CONST.EMAIL.CONCIERGE) {
personalDetail.avatar = CONST.CONCIERGE_ICON_URL;
}

personalDetailsForLogins[login] = personalDetail;
});
personalDetailsForLogins[login] = personalDetail;
});
return personalDetailsForLogins;
}

Expand Down

0 comments on commit 413dd0d

Please sign in to comment.