浏览代码

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

Timothy Flynn 1 年之前
父节点
当前提交
775282f9fc
共有 1 个文件被更改,包括 1 次插入1 次删除
  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);