2
0
Эх сурвалжийг харах

Fix unintended call to sq_base_register when not creating a new root table, this bug was pointed on squirrel forum by lucasc190.

mingodad 11 жил өмнө
parent
commit
8025c6c450

+ 5 - 4
SquiLu/squirrel/sqvm.cpp

@@ -392,9 +392,10 @@ bool SQVM::Init(SQVM *friendvm, SQInteger stacksize)
 	_callsstack = &_callstackdata[0];
 	_callsstack = &_callstackdata[0];
 	_stackbase = 0;
 	_stackbase = 0;
 	_top = 0;
 	_top = 0;
-	if(!friendvm)
+	if(!friendvm) {
 		_roottable = SQTable::Create(_ss(this), 0);
 		_roottable = SQTable::Create(_ss(this), 0);
-	else {
+        sq_base_register(this);
+	} else {
 		_roottable = friendvm->_roottable;
 		_roottable = friendvm->_roottable;
 		_errorhandler = friendvm->_errorhandler;
 		_errorhandler = friendvm->_errorhandler;
 		_debughook = friendvm->_debughook;
 		_debughook = friendvm->_debughook;
@@ -402,7 +403,6 @@ bool SQVM::Init(SQVM *friendvm, SQInteger stacksize)
 		_debughook_closure = friendvm->_debughook_closure;
 		_debughook_closure = friendvm->_debughook_closure;
 	}
 	}
 
 
-	sq_base_register(this);
 	return true;
 	return true;
 }
 }
 
 
@@ -973,7 +973,8 @@ exception_restore:
 						//SQ_THROW();
 						//SQ_THROW();
 					  }
 					  }
 					default:
 					default:
-						Raise_Error(_SC("attempt to call '%s'"), GetTypeName(clo));
+						Raise_Error(_SC("attempt to call '%s' [%s]"), GetTypeName(clo),
+                            type(clo) == OT_STRING ? _stringval(clo) : "");
 						SQ_THROW();
 						SQ_THROW();
 					}
 					}
 				}
 				}