Skip to content

Commit

Permalink
Merge pull request #693 from cabinetoffice/tidying/possible-null-refe…
Browse files Browse the repository at this point in the history
…rence

Remove the warning: "[CS8602] Dereference of a possibly null reference."
  • Loading branch information
jakzal authored Oct 2, 2024
2 parents e3c052d + 72987a6 commit eb6c9a7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ public async Task<IEnumerable<AnswerSummary>> GetAnswers()

var summary = new AnswerSummary
{
Title = question.SummaryTitle ?? question.Title,
Title = question?.SummaryTitle ?? question?.Title,
Answer = answerString,
ChangeLink = $"/organisation/{OrganisationId}/forms/{FormId}/sections/{SectionId}/questions/{answer.QuestionId}?frm-chk-answer=true"
};

if (question.Type == FormQuestionType.Address && answer.Answer?.AddressValue != null
&& answer.Answer.AddressValue.Country != Constants.Country.UKCountryCode)
if (question?.Type == FormQuestionType.Address && answer.Answer?.AddressValue != null
&& answer.Answer.AddressValue.Country != Country.UKCountryCode)
{
summary.ChangeLink += "&UkOrNonUk=non-uk";
}
Expand Down

0 comments on commit eb6c9a7

Please sign in to comment.