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

Minor fix in Squirrel. Don't always assume the specified parameter is a string.

This commit is contained in:
Sandu Liviu Catalin 2016-11-16 11:50:40 +02:00
parent f8e57bf060
commit ed599c06dd

View File

@ -69,7 +69,10 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
const SQChar *format; const SQChar *format;
SQChar *dest; SQChar *dest;
SQChar fmt[MAX_FORMAT_LEN]; SQChar fmt[MAX_FORMAT_LEN];
sq_getstring(v,nformatstringidx,&format); const SQRESULT res = sq_getstring(v,nformatstringidx,&format);
if (SQ_FAILED(res)) {
return res; // propagate the error
}
SQInteger format_size = sq_getsize(v,nformatstringidx); SQInteger format_size = sq_getsize(v,nformatstringidx);
SQInteger allocated = (format_size+2)*sizeof(SQChar); SQInteger allocated = (format_size+2)*sizeof(SQChar);
dest = sq_getscratchpad(v,allocated); dest = sq_getscratchpad(v,allocated);