Fix botlib parser for negative int/float values, thanks to Makro for reporting (#4227).
This commit is contained in:
parent
5663ff1362
commit
ba31be1736
3 changed files with 48 additions and 17 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue