literal API: add empty string check.

fixes github issue #302, #304
This commit is contained in:
Hong, Yang A 2021-03-04 16:13:46 +00:00 committed by Konstantinos Margaritis
parent 4f27a70dd7
commit 70b2a28386

View File

@ -417,6 +417,10 @@ void addLitExpression(NG &ng, unsigned index, const char *expression,
"HS_FLAG_SOM_LEFTMOST are supported in literal API.");
}
if (!strcmp(expression, "")) {
throw CompileError("Pure literal API doesn't support empty string.");
}
// This expression must be a pure literal, we can build ue2_literal
// directly based on expression text.
ParsedLitExpression ple(index, expression, expLength, flags, id);