make sure str2chr always returns a positive value.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4369 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-05-14 13:01:52 +00:00
parent 5086f30e79
commit ef1a55ff9c

View file

@ -2165,7 +2165,7 @@ void QCBUILTIN PF_str2chr (pubprogfuncs_t *prinst, struct globalvars_s *pr_globa
if (ofs && (ofs < 0 || ofs > strlen(instr)))
G_FLOAT(OFS_RETURN) = '\0';
else
G_FLOAT(OFS_RETURN) = VMUTF8?unicode_decode(NULL, instr+ofs, NULL):instr[ofs];
G_FLOAT(OFS_RETURN) = VMUTF8?unicode_decode(NULL, instr+ofs, NULL):(unsigned char)instr[ofs];
}
//FTE_STRINGS