cannot compare doubles with == sainly, switch to checking if difference is less than 0.000001 instead

This commit is contained in:
Patric Karlström 2021-01-13 16:16:29 +01:00
parent e18a740b20
commit 4ffc054bdd

View file

@ -634,8 +634,8 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
showError(getString(R.string.please_enter_valid_deposit)); showError(getString(R.string.please_enter_valid_deposit));
return; return;
} }
if (depositAmount == 0) { if (depositAmount <= 0.000001) {
String error = getResources().getQuantityString(R.plurals.min_deposit_required, depositAmount == 1 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT)); String error = getResources().getQuantityString(R.plurals.min_deposit_required, Math.abs(depositAmount-1.0) <= 0.000001 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT));
showError(error); showError(error);
return; return;
} }