Add guards on debug output.
This commit is contained in:
@@ -365,9 +365,13 @@ public class Print extends Lua {
|
|||||||
break;
|
break;
|
||||||
case LuaValue.TUSERDATA:
|
case LuaValue.TUSERDATA:
|
||||||
Object o = v.touserdata();
|
Object o = v.touserdata();
|
||||||
String n = o.getClass().getName();
|
if ( o != null ) {
|
||||||
n = n.substring(n.lastIndexOf('.')+1);
|
String n = o.getClass().getName();
|
||||||
ps.print( n+": "+Integer.toHexString(o.hashCode()) );
|
n = n.substring(n.lastIndexOf('.')+1);
|
||||||
|
ps.print( n+": "+Integer.toHexString(o.hashCode()) );
|
||||||
|
} else {
|
||||||
|
ps.print( v.toString() );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ps.print(v.tojstring());
|
ps.print(v.tojstring());
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ public class DebugLib extends VarArgFunction {
|
|||||||
return;
|
return;
|
||||||
DebugInfo di = ds.getDebugInfo();
|
DebugInfo di = ds.getDebugInfo();
|
||||||
if(TRACE)Print.printState(di.closure, pc, di.stack, top, di.varargs);
|
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.hookcount > 0 ) {
|
||||||
if ( ++ds.hookcodes >= ds.hookcount ) {
|
if ( ++ds.hookcodes >= ds.hookcount ) {
|
||||||
ds.hookcodes = 0;
|
ds.hookcodes = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user