From e62cf67be574c8cbab84720b60a895ccb9c1816d Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 28 Feb 2021 20:41:47 +0000 Subject: [PATCH] Add more defensive code in TaxRateFinder --- app/services/tax_rate_finder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/tax_rate_finder.rb b/app/services/tax_rate_finder.rb index f27a42ef85..01b955d3d0 100644 --- a/app/services/tax_rate_finder.rb +++ b/app/services/tax_rate_finder.rb @@ -75,7 +75,7 @@ class TaxRateFinder # to the included tax. def find_closest_tax_rates_from_included_tax(amount, included_tax) approximation = (included_tax / (amount - included_tax)) - return [] if approximation.infinite? || approximation.zero? + return [] if approximation.infinite? || approximation.zero? || approximation.nan? [Spree::TaxRate.order("ABS(amount - #{approximation})").first] end