Pārlūkot izejas kodu

LibWebView: Stop tokenizing the source HTML once we hit an EOF token

Timothy Flynn 1 gadu atpakaļ
vecāks
revīzija
775282f9fc

+ 1 - 1
Userland/Libraries/LibWebView/SourceHighlighter.cpp

@@ -60,7 +60,7 @@ String highlight_source(URL::URL const& url, StringView source)
         previous_position = end_position;
         previous_position = end_position;
     };
     };
 
 
-    for (auto token = tokenizer.next_token(); token.has_value(); token = tokenizer.next_token()) {
+    for (auto token = tokenizer.next_token(); token.has_value() && !token->is_end_of_file(); token = tokenizer.next_token()) {
         if (token->is_comment()) {
         if (token->is_comment()) {
             append_source(token->start_position().byte_offset);
             append_source(token->start_position().byte_offset);
             append_source(token->end_position().byte_offset, "comment"sv);
             append_source(token->end_position().byte_offset, "comment"sv);