Add guards on debug output.
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user