summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-13 20:41:49 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-13 20:41:49 +0000
commitfe8edacf0885fda5a98f5606e281852e867007ec (patch)
tree60070847eaf000eae514d43f44b8724e7643b434
parent0f72b9472401e8e001b52c3da5f01992d4c97c29 (diff)
downloadEssentials-fe8edacf0885fda5a98f5606e281852e867007ec.tar
Essentials-fe8edacf0885fda5a98f5606e281852e867007ec.tar.gz
Essentials-fe8edacf0885fda5a98f5606e281852e867007ec.tar.lz
Essentials-fe8edacf0885fda5a98f5606e281852e867007ec.tar.xz
Essentials-fe8edacf0885fda5a98f5606e281852e867007ec.zip
Catch the case, if the user does not have a account with Register
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1439 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index 443a6b612..c9ec16d2d 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
+import com.nijikokun.register.payment.Method;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Logger;
@@ -277,7 +278,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo
{
try
{
- return ess.getPaymentMethod().getMethod().getAccount(this.getName()).balance();
+ Method method = ess.getPaymentMethod().getMethod();
+ if (!method.hasAccount(this.getName())) {
+ throw new Exception();
+ }
+ Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
+ return account.balance();
}
catch (Throwable ex)
{
@@ -293,8 +299,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo
{
try
{
- double amount = value - ess.getPaymentMethod().getMethod().getAccount(this.getName()).balance();
- ess.getPaymentMethod().getMethod().getAccount(this.getName()).add(amount);
+ Method method = ess.getPaymentMethod().getMethod();
+ if (!method.hasAccount(this.getName())) {
+ throw new Exception();
+ }
+ Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
+ double amount = value - account.balance();
+ account.add(amount);
}
catch (Throwable ex)
{