Fix botlib parser for negative int/float values, thanks to Makro for reporting (#4227).

This commit is contained in:
Thilo Schulz 2009-10-19 23:29:44 +00:00
parent 5663ff1362
commit ba31be1736
3 changed files with 48 additions and 17 deletions

View file

@ -64,13 +64,20 @@ int ReadValue(source_t *source, float *value)
if (!strcmp(token.string, "-"))
{
SourceWarning(source, "negative value set to zero\n");
if (!PC_ExpectTokenType(source, TT_NUMBER, 0, &token)) return qfalse;
} //end if
if(!PC_ExpectAnyToken(source, &token))
{
SourceError(source, "Missing return value\n");
return qfalse;
}
}
if (token.type != TT_NUMBER)
{
SourceError(source, "invalid return value %s\n", token.string);
return qfalse;
} //end if
}
*value = token.floatvalue;
return qtrue;
} //end of the function ReadValue