From ec6baa3621bb9d0a40f032f6669c11fa731be2c5 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 19:13:39 +0100 Subject: Catch exception instead of checking for null --- .../src/com/earth2me/essentials/commands/Commandunbanip.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java index 2b22ede2c..c539a596c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java @@ -20,10 +20,14 @@ public class Commandunbanip extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - User user = getPlayer(server, args, 0, true); - if (user != null) { + try + { + final User user = getPlayer(server, args, 0, true); ess.getServer().unbanIP(user.getLastLoginAddress()); } + catch (Exception ex) + { + } ess.getServer().unbanIP(args[0]); sender.sendMessage(_("unbannedIP")); } -- cgit v1.2.3