diff --git a/src/core/org/luaj/vm2/Print.java b/src/core/org/luaj/vm2/Print.java index a682957b..da6cc6b2 100644 --- a/src/core/org/luaj/vm2/Print.java +++ b/src/core/org/luaj/vm2/Print.java @@ -365,9 +365,13 @@ public class Print extends Lua { break; case LuaValue.TUSERDATA: Object o = v.touserdata(); - String n = o.getClass().getName(); - n = n.substring(n.lastIndexOf('.')+1); - ps.print( n+": "+Integer.toHexString(o.hashCode()) ); + if ( o != null ) { + String n = o.getClass().getName(); + n = n.substring(n.lastIndexOf('.')+1); + ps.print( n+": "+Integer.toHexString(o.hashCode()) ); + } else { + ps.print( v.toString() ); + } break; default: ps.print(v.tojstring()); diff --git a/src/core/org/luaj/vm2/lib/DebugLib.java b/src/core/org/luaj/vm2/lib/DebugLib.java index 0dee5d2a..0cd9b359 100644 --- a/src/core/org/luaj/vm2/lib/DebugLib.java +++ b/src/core/org/luaj/vm2/lib/DebugLib.java @@ -352,7 +352,7 @@ public class DebugLib extends VarArgFunction { return; DebugInfo di = ds.getDebugInfo(); if(TRACE)Print.printState(di.closure, pc, di.stack, top, di.varargs); - ds.getDebugInfo().bytecode( pc, extras, top ); + di.bytecode( pc, extras, top ); if ( ds.hookcount > 0 ) { if ( ++ds.hookcodes >= ds.hookcount ) { ds.hookcodes = 0;