From 289c466fef0dfb2cac35f0c989f3eb2b3d93c345 Mon Sep 17 00:00:00 2001 From: Itamar Date: Thu, 4 Mar 2021 13:23:24 +0200 Subject: [PATCH] LibCpp: Don't crash on an empty '#' line Closes #5634 --- Userland/Libraries/LibCpp/Preprocessor.cpp | 2 ++ 1 file changed, 2 insertions(+) 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();