Ver Fonte

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

Timothy Flynn há 1 ano atrás
pai
commit
775282f9fc
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      Userland/Libraries/LibWebView/SourceHighlighter.cpp

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

@@ -60,7 +60,7 @@ String highlight_source(URL::URL const& url, StringView source)
         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()) {
             append_source(token->start_position().byte_offset);
             append_source(token->end_position().byte_offset, "comment"sv);