summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-08-11 13:43:04 +0200
committersnowleo <schneeleo@gmail.com>2011-08-11 13:43:04 +0200
commit93883cfc1231824fcabd061b4c01580cd172dd04 (patch)
tree48a007567de1f84cf5d4b66bdf8cef779c203dca
parent2e565f88811b5b54bd6e5b5d8ea091694ba69a3e (diff)
downloadEssentials-93883cfc1231824fcabd061b4c01580cd172dd04.tar
Essentials-93883cfc1231824fcabd061b4c01580cd172dd04.tar.gz
Essentials-93883cfc1231824fcabd061b4c01580cd172dd04.tar.lz
Essentials-93883cfc1231824fcabd061b4c01580cd172dd04.tar.xz
Essentials-93883cfc1231824fcabd061b4c01580cd172dd04.zip
Catch NPE while login of new player
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java5
2 files changed, 12 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 117c3717d..a3457df12 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -561,8 +561,14 @@ public class Essentials extends JavaPlugin implements IEssentials
{
return (User)base;
}
- //Todo: catch this and deal with it?
- return userMap.getUser(base.getName()).update(base);
+ try
+ {
+ return userMap.getUser(base.getName()).update(base);
+ }
+ catch (NullPointerException ex)
+ {
+ return null;
+ }
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 2a3ba77f1..ff32a9636 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -303,7 +303,10 @@ public class EssentialsPlayerListener extends PlayerListener
{
return;
}
- final User user = ess.getUser(event.getPlayer());
+ User user = ess.getUser(event.getPlayer());
+ if (user == null) {
+ user = new User(event.getPlayer(), ess);
+ }
user.setNPC(false);
final long currentTime = System.currentTimeMillis();