1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Update sqratUtil.h

This commit is contained in:
Sandu Liviu Catalin 2021-03-31 18:45:24 +03:00
parent f69769d32b
commit 4a238bc611

View File

@ -519,8 +519,16 @@ inline string LastErrorString(HSQUIRRELVM vm) {
sq_pop(vm, 1); sq_pop(vm, 1);
return string(); return string();
} }
sq_tostring(vm, -1); if (SQ_SUCCEEDED(sq_tostring(vm, -1)))
{
sq_getstringandsize(vm, -1, &sqErr, &size); sq_getstringandsize(vm, -1, &sqErr, &size);
}
else
{
sqErr = _SC("unknown error");
size = strlen(sqErr);
sq_pushnull(vm);
}
sq_pop(vm, 2); sq_pop(vm, 2);
return string(sqErr, static_cast< size_t >(size)); return string(sqErr, static_cast< size_t >(size));
} }