@@ -1582,7 +1582,10 @@ SQInteger constructor_stub(HSQUIRRELVM vm)
15821582SQInteger tostring_stub (HSQUIRRELVM vm)
15831583{
15841584 ClassInstanceData* classInstanceData = nullptr ;
1585- sq_getinstanceup (vm, 1 , (SQUserPointer*)&classInstanceData, 0 );
1585+ if (SQ_FAILED (sq_getinstanceup (vm, 1 , (SQUserPointer*)&classInstanceData, 0 )))
1586+ {
1587+ return SQ_ERROR ;
1588+ }
15861589
15871590 char buffer[128 ] = " " ;
15881591
@@ -1612,7 +1615,10 @@ SQInteger tostring_stub(HSQUIRRELVM vm)
16121615SQInteger get_stub (HSQUIRRELVM vm)
16131616{
16141617 ClassInstanceData* classInstanceData = nullptr ;
1615- sq_getinstanceup (vm, 1 , (SQUserPointer*)&classInstanceData, 0 );
1618+ if (SQ_FAILED (sq_getinstanceup (vm, 1 , (SQUserPointer*)&classInstanceData, 0 )))
1619+ {
1620+ return SQ_ERROR ;
1621+ }
16161622
16171623 const char * key = nullptr ;
16181624 sq_getstring (vm, 2 , &key);
@@ -1644,7 +1650,10 @@ SQInteger get_stub(HSQUIRRELVM vm)
16441650SQInteger set_stub (HSQUIRRELVM vm)
16451651{
16461652 ClassInstanceData* classInstanceData = nullptr ;
1647- sq_getinstanceup (vm, 1 , (SQUserPointer*)&classInstanceData, 0 );
1653+ if (SQ_FAILED (sq_getinstanceup (vm, 1 , (SQUserPointer*)&classInstanceData, 0 )))
1654+ {
1655+ return SQ_ERROR ;
1656+ }
16481657
16491658 const char * key = nullptr ;
16501659 sq_getstring (vm, 2 , &key);
@@ -2740,10 +2749,8 @@ void SquirrelVM::SetInstanceUniqeId(HSCRIPT hInstance, const char* pszId)
27402749 HSQOBJECT * obj = (HSQOBJECT *)hInstance;
27412750 sq_pushobject (vm_, *obj);
27422751
2743- SQUserPointer self;
2744- sq_getinstanceup (vm_, -1 , &self, nullptr );
2745-
2746- auto classInstanceData = (ClassInstanceData*)self;
2752+ ClassInstanceData* classInstanceData;
2753+ sq_getinstanceup (vm_, -1 , (SQUserPointer*)&classInstanceData, nullptr );
27472754
27482755 classInstanceData->instanceId = pszId;
27492756
@@ -2801,11 +2808,10 @@ void* SquirrelVM::GetInstanceValue(HSCRIPT hInstance, ScriptClassDesc_t* pExpect
28012808 }
28022809
28032810 sq_pushobject (vm_, *obj);
2804- SQUserPointer self ;
2805- sq_getinstanceup (vm_, -1 , &self , nullptr );
2811+ ClassInstanceData* classInstanceData ;
2812+ sq_getinstanceup (vm_, -1 , (SQUserPointer*)&classInstanceData , nullptr );
28062813 sq_pop (vm_, 1 );
28072814
2808- auto classInstanceData = (ClassInstanceData*)self;
28092815
28102816 if (!classInstanceData)
28112817 {
0 commit comments