mirror of https://github.com/MilkBowl/Vault.git
Add null check on playernames for #782
Add a simple null check on playernames for deposit/withdraw to prevent NPEs in essentials economy even though they should be handled in essentials.
This commit is contained in:
parent
2a85b772ef
commit
d17f3c0fbd
|
@ -95,6 +95,9 @@ public class Economy_Essentials extends AbstractEconomy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EconomyResponse withdrawPlayer(String playerName, double amount) {
|
public EconomyResponse withdrawPlayer(String playerName, double amount) {
|
||||||
|
if (playerName == null) {
|
||||||
|
return new EconomyResponse(0, 0 ResponseType.FAILURE, "Player name can not be null.");
|
||||||
|
}
|
||||||
if (amount < 0) {
|
if (amount < 0) {
|
||||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds");
|
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds");
|
||||||
}
|
}
|
||||||
|
@ -134,6 +137,9 @@ public class Economy_Essentials extends AbstractEconomy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public EconomyResponse tryDepositPlayer(String playerName, double amount, int tries) {
|
public EconomyResponse tryDepositPlayer(String playerName, double amount, int tries) {
|
||||||
|
if (playerName == null) {
|
||||||
|
return new EconomyResponse(0, 0 ResponseType.FAILURE, "Player name can not be null.");
|
||||||
|
}
|
||||||
if (amount < 0) {
|
if (amount < 0) {
|
||||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot desposit negative funds");
|
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot desposit negative funds");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue