From 033345dbb3547f23788f66acf08e67e6783f881f Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Mon, 7 Dec 2015 12:33:33 -0500 Subject: [PATCH] Check that hit.address exists Fixes #379 --- middleware/confidenceScore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/middleware/confidenceScore.js b/middleware/confidenceScore.js index b100b973..0eae0f8d 100644 --- a/middleware/confidenceScore.js +++ b/middleware/confidenceScore.js @@ -100,7 +100,8 @@ function checkForDealBreakers(req, hit) { return true; } - if (check.assigned(req.clean.parsed_text.postalcode) && req.clean.parsed_text.postalcode !== hit.address.zip) { + if (check.assigned(req.clean.parsed_text.postalcode) && check.assigned(hit.address) && + req.clean.parsed_text.postalcode !== hit.address.zip) { logger.debug('[confidence][deal-breaker]: postalcode !== zip (' + req.clean.parsed_text.postalcode + ' !== ' + hit.address.zip + ')'); return true; }