[Fix] When the minimum pay amount is zero, users are unable to pay zero.

This commit is contained in:
Luke Anderson 2016-12-02 18:34:16 +10:30 committed by Ali Moghnieh
parent 5fda1d018b
commit a6f1e305ef
No known key found for this signature in database
GPG Key ID: F09D3A1BAF2E6D70
1 changed files with 4 additions and 3 deletions

View File

@ -147,10 +147,11 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
}
@Override
public void payUser(final User reciever, final BigDecimal value) throws ChargeException, MaxMoneyException {
if (value.signum() == 0) {
return;
public void payUser(final User reciever, final BigDecimal value) throws Exception {
if (value.compareTo(BigDecimal.ZERO) < 1) {
throw new Exception(tl("payMustBePositive"));
}
if (canAfford(value)) {
setMoney(getMoney().subtract(value));
reciever.setMoney(reciever.getMoney().add(value));