From ada98349ec09bc8ceb51c6b712f566ed0e8ae2ee Mon Sep 17 00:00:00 2001 From: CatalinVoineag <11318084+CatalinVoineag@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:45:26 +0000 Subject: [PATCH] Don't pass nil email address to EmailChecker In production we have over 12k application references with nil email addresses. The EmailChecker class expects an email and not a nil value. This creates a few exceptions when a candidate inputs a reference. This commit tries to make sure this class doesn't receive a nil parameter. --- .../application_review_and_submit_component.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/candidate_interface/application_review_and_submit_component.rb b/app/components/candidate_interface/application_review_and_submit_component.rb index ae3f2505c77..04683a7ffaa 100644 --- a/app/components/candidate_interface/application_review_and_submit_component.rb +++ b/app/components/candidate_interface/application_review_and_submit_component.rb @@ -44,7 +44,7 @@ def references_with_personal_email_addresses? application_form.unsubmitted? && # One or more of the professional references has a personal email address application_form.application_references.pluck(:referee_type, :email_address).any? do |referee_type, email_address| - referee_type != 'character' && EmailChecker.new(email_address).personal? + referee_type != 'character' && email_address.present? && EmailChecker.new(email_address).personal? end end