From df6167cb665b22d5eb456deb7d4248066cec93d4 Mon Sep 17 00:00:00 2001 From: James Roseborough Date: Sun, 9 Mar 2014 18:05:25 +0000 Subject: [PATCH] Guard against exceptions when reading properties. --- src/core/org/luaj/vm2/lib/DebugLib.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/org/luaj/vm2/lib/DebugLib.java b/src/core/org/luaj/vm2/lib/DebugLib.java index 860771c9..17001b3a 100644 --- a/src/core/org/luaj/vm2/lib/DebugLib.java +++ b/src/core/org/luaj/vm2/lib/DebugLib.java @@ -72,8 +72,12 @@ import org.luaj.vm2.Varargs; * @see Lua 5.2 Debug Lib Reference */ public class DebugLib extends TwoArgFunction { - public static final boolean CALLS = (null != System.getProperty("CALLS")); - public static final boolean TRACE = (null != System.getProperty("TRACE")); + public static boolean CALLS; + public static boolean TRACE; + static { + try { CALLS = (null != System.getProperty("CALLS")); } catch (Exception e) {} + try { TRACE = (null != System.getProperty("TRACE")); } catch (Exception e) {} + } private static final LuaString LUA = valueOf("Lua"); private static final LuaString QMARK = valueOf("?");