Skip to content

Commit 5b2e1eb

Browse files
hongyang7fatchanghao
authored andcommitted
literal API: add empty string check.
fixes github issue #302, #304
1 parent a5a78f6 commit 5b2e1eb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/compiler/compiler.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ void addLitExpression(NG &ng, unsigned index, const char *expression,
416416
"HS_FLAG_SOM_LEFTMOST are supported in literal API.");
417417
}
418418

419+
if (!strcmp(expression, "")) {
420+
throw CompileError("Pure literal API doesn't support empty string.");
421+
}
422+
419423
// This expression must be a pure literal, we can build ue2_literal
420424
// directly based on expression text.
421425
ParsedLitExpression ple(index, expression, expLength, flags, id);

0 commit comments

Comments
 (0)