diff --git a/sp/src/vscript/vscript_squirrel.cpp b/sp/src/vscript/vscript_squirrel.cpp index f2a27755..8acba22f 100644 --- a/sp/src/vscript/vscript_squirrel.cpp +++ b/sp/src/vscript/vscript_squirrel.cpp @@ -1548,7 +1548,15 @@ SQInteger destructor_stub_instance(SQUserPointer p, SQInteger size) SQInteger constructor_stub(HSQUIRRELVM vm) { ScriptClassDesc_t* pClassDesc = nullptr; - sq_gettypetag(vm, 1, (SQUserPointer*)&pClassDesc); + if (SQ_FAILED(sq_gettypetag(vm, 1, (SQUserPointer*)&pClassDesc))) + { + return sq_throwerror(vm, "Expected native class"); + } + + if (!pClassDesc || (void*)pClassDesc == TYPETAG_VECTOR) + { + return sq_throwerror(vm, "Unable to obtain native class description"); + } if (!pClassDesc->m_pfnConstruct) {