summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-03-04 13:23:24 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-06 09:40:33 +0100
commit289c466fef0dfb2cac35f0c989f3eb2b3d93c345 (patch)
treefef3e220b134be5467f494e544542b6469359fd8 /Userland/Libraries
parent3f0ace6670c5b52cb74e2b97fd679efde9d5fe0e (diff)
downloadserenity-289c466fef0dfb2cac35f0c989f3eb2b3d93c345.zip
LibCpp: Don't crash on an empty '#' line
Closes #5634
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibCpp/Preprocessor.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCpp/Preprocessor.cpp b/Userland/Libraries/LibCpp/Preprocessor.cpp
index 99bef96ea3..e276017455 100644
--- a/Userland/Libraries/LibCpp/Preprocessor.cpp
+++ b/Userland/Libraries/LibCpp/Preprocessor.cpp
@@ -67,6 +67,8 @@ void Preprocessor::handle_preprocessor_line(const StringView& line)
lexer.consume_specific('#');
consume_whitespace();
auto keyword = lexer.consume_until(' ');
+ if (keyword.is_empty() || keyword.is_null() || keyword.is_whitespace())
+ return;
if (keyword == "include") {
consume_whitespace();