mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibGUI: Fix CppLexer assertion on incomplete #include statements
Thanks to @NotKyon for reporting this bug with a solid analysis. Fixes #1488.
This commit is contained in:
@@ -363,16 +363,16 @@ Vector<CppToken> CppLexer::lex()
|
||||
begin_token();
|
||||
if (peek() == '<' || peek() == '"') {
|
||||
char closing = consume() == '<' ? '>' : '"';
|
||||
while (peek() != closing && peek() != '\n')
|
||||
while (peek() && peek() != closing && peek() != '\n')
|
||||
consume();
|
||||
|
||||
if (consume() == '\n') {
|
||||
if (peek() && consume() == '\n') {
|
||||
commit_token(CppToken::Type::IncludePath);
|
||||
continue;
|
||||
} else {
|
||||
commit_token(CppToken::Type::IncludePath);
|
||||
begin_token();
|
||||
}
|
||||
|
||||
commit_token(CppToken::Type::IncludePath);
|
||||
begin_token();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user