From d6e29b3f29d87663922573dd450673a2dc4bbe32 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 15 Mar 2013 20:38:40 +1100 Subject: [PATCH] Fix issue #203 - errors in Util.exception when no trace present. --- proxy/src/main/java/net/md_5/bungee/Util.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/net/md_5/bungee/Util.java b/proxy/src/main/java/net/md_5/bungee/Util.java index 605cbe22..7dccf9aa 100644 --- a/proxy/src/main/java/net/md_5/bungee/Util.java +++ b/proxy/src/main/java/net/md_5/bungee/Util.java @@ -68,6 +68,9 @@ public class Util */ public static String exception(Throwable t) { - return t.getClass().getSimpleName() + " : " + t.getMessage() + " @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber(); + // TODO: We should use clear manually written exceptions + StackTraceElement[] trace = t.getStackTrace(); + return t.getClass().getSimpleName() + " : " + t.getMessage() + + ( ( trace.length > 0 ) ? " @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber() : "" ); } }