Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct NPE in address iterator. #4184

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ public IActionResult AddOrganization([FromBody] OrganizationModel model, bool us
{
// Business rule - support country free-form value if country code is "Other". Ignore field otherwise.
var otherCountry = _lookupRepository.GetAllCountries().FirstOrDefault(x => x.Code == Dal.Entities.CountryCodes.Other);
foreach (var organizationAddress in model?.OrganizationAddresses)
if (model?.OrganizationAddresses != null)
{
if (otherCountry != null && organizationAddress?.Address != null && organizationAddress.Address.CountryId != otherCountry.CountryId)
foreach (var organizationAddress in model?.OrganizationAddresses)
{
organizationAddress.Address.CountryOther = null;
if (otherCountry != null && organizationAddress?.Address != null && organizationAddress.Address.CountryId != otherCountry.CountryId)
{
organizationAddress.Address.CountryOther = null;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ public IActionResult AddPerson([FromBody] PersonModel model, bool userOverride =
{
// Business rule - support country free-form value if country code is "Other". Ignore field otherwise.
var otherCountry = _lookupRepository.GetAllCountries().FirstOrDefault(x => x.Code == Dal.Entities.CountryCodes.Other);
foreach (var personAddress in model?.PersonAddresses)
if (model?.PersonAddresses != null)
{
if (otherCountry != null && personAddress != null && personAddress.Address.CountryId != otherCountry.CountryId)
foreach (var personAddress in model?.PersonAddresses)
{
personAddress.Address.CountryOther = null;
if (otherCountry != null && personAddress != null && personAddress.Address.CountryId != otherCountry.CountryId)
{
personAddress.Address.CountryOther = null;
}
}
}

Expand Down
Loading