fix: correctly test the alert thresholds (considering falsy values)

This commit is contained in:
Liordino Neto 2020-11-03 13:50:30 -03:00 committed by Josh Harvey
parent b1574c277a
commit 106fa166b0

View file

@ -706,10 +706,10 @@ function plugins (settings, deviceId) {
fiatCode,
}
if (lowAlertThreshold && BN(fiatBalance.balance).lt(lowAlertThreshold))
if (_.isFinite(lowAlertThreshold) && BN(fiatBalance.balance).lt(lowAlertThreshold))
return _.set('code')('LOW_CRYPTO_BALANCE')(req)
if (highAlertThreshold && BN(fiatBalance.balance).gt(highAlertThreshold))
if (_.isFinite(highAlertThreshold) && BN(fiatBalance.balance).gt(highAlertThreshold))
return _.set('code')('HIGH_CRYPTO_BALANCE')(req)
return null