From ed599c06dde17de4e0742e738f4e757265fc26fb Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Wed, 16 Nov 2016 11:50:40 +0200 Subject: [PATCH] Minor fix in Squirrel. Don't always assume the specified parameter is a string. --- external/Squirrel/Lib/sqstdstring.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/external/Squirrel/Lib/sqstdstring.cpp b/external/Squirrel/Lib/sqstdstring.cpp index 9e42dba4..bd052331 100644 --- a/external/Squirrel/Lib/sqstdstring.cpp +++ b/external/Squirrel/Lib/sqstdstring.cpp @@ -69,7 +69,10 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen const SQChar *format; SQChar *dest; 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 allocated = (format_size+2)*sizeof(SQChar); dest = sq_getscratchpad(v,allocated);