summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-02-14 20:29:45 +0100
committersnowleo <schneeleo@gmail.com>2012-02-14 20:30:06 +0100
commit3c98718387cf8c612e11f00df216c9ffb268568e (patch)
tree5b4a5e86b6b14237193aece9af226d586a9f940e
parentcfdb2a36c129ad9cf1cfede9ef559a2ae9711b24 (diff)
downloadEssentials-3c98718387cf8c612e11f00df216c9ffb268568e.tar
Essentials-3c98718387cf8c612e11f00df216c9ffb268568e.tar.gz
Essentials-3c98718387cf8c612e11f00df216c9ffb268568e.tar.lz
Essentials-3c98718387cf8c612e11f00df216c9ffb268568e.tar.xz
Essentials-3c98718387cf8c612e11f00df216c9ffb268568e.zip
Don't return null, throw an exception
-rw-r--r--Essentials/src/com/earth2me/essentials/UserMap.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/UserMap.java b/Essentials/src/com/earth2me/essentials/UserMap.java
index f15e5edd9..94b504241 100644
--- a/Essentials/src/com/earth2me/essentials/UserMap.java
+++ b/Essentials/src/com/earth2me/essentials/UserMap.java
@@ -77,8 +77,17 @@ public class UserMap extends CacheLoader<String, User> implements IConf
public User load(final String name) throws Exception
{
String sanitizedName = Util.sanitizeFileName(name);
- if (!sanitizedName.equals(name)) {
- return getUser(sanitizedName);
+ if (!sanitizedName.equals(name))
+ {
+ User user = getUser(sanitizedName);
+ if (user == null)
+ {
+ throw new Exception("User not found!");
+ }
+ else
+ {
+ return user;
+ }
}
for (Player player : ess.getServer().getOnlinePlayers())
{
@@ -119,12 +128,12 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
return keys.size();
}
-
+
public File getUserFile(final String name)
{
return getUserFile2(Util.sanitizeFileName(name));
}
-
+
private File getUserFile2(final String name)
{
final File userFolder = new File(ess.getDataFolder(), "userdata");