diff options
author | snowleo <schneeleo@gmail.com> | 2011-12-19 11:53:34 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-12-19 11:53:52 +0100 |
commit | 8761feb93f6dc0af2ee83f2eb7addcbc73e23cb8 (patch) | |
tree | 08948098b4dc94d518f482a6507ef2e22f7cc339 | |
parent | fec3b610392311a75701299c98cc6a34f2f27cf2 (diff) | |
download | Essentials-8761feb93f6dc0af2ee83f2eb7addcbc73e23cb8.tar Essentials-8761feb93f6dc0af2ee83f2eb7addcbc73e23cb8.tar.gz Essentials-8761feb93f6dc0af2ee83f2eb7addcbc73e23cb8.tar.lz Essentials-8761feb93f6dc0af2ee83f2eb7addcbc73e23cb8.tar.xz Essentials-8761feb93f6dc0af2ee83f2eb7addcbc73e23cb8.zip |
More null checks for Jails
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Jails.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java index 4c1090c5c..f8ab2d02e 100644 --- a/Essentials/src/com/earth2me/essentials/Jails.java +++ b/Essentials/src/com/earth2me/essentials/Jails.java @@ -59,7 +59,12 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett { throw new Exception(_("jailNotExist")); } - return getData().getJails().get(jailName.toLowerCase(Locale.ENGLISH)); + Location loc = getData().getJails().get(jailName.toLowerCase(Locale.ENGLISH)); + if (loc == null || loc.getWorld() == null) + { + throw new Exception(_("jailNotExist")); + } + return loc; } finally { @@ -111,7 +116,8 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett { if (!(user.getBase() instanceof OfflinePlayer)) { - user.getTeleport().now(getJail(jail), false, TeleportCause.COMMAND); + Location loc = getJail(jail); + user.getTeleport().now(loc, false, TeleportCause.COMMAND); } user.setJail(jail); } |