Fix botlib parser for negative int/float values, thanks to Makro for reporting (#4227).
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user