浏览代码

LibWeb: Null-check document before doing layout in PageHost::paint()

Andreas Kling 3 年之前
父节点
当前提交
03c3b3b7e5
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      Userland/Services/WebContent/PageHost.cpp

+ 2 - 3
Userland/Services/WebContent/PageHost.cpp

@@ -64,9 +64,8 @@ void PageHost::paint(const Gfx::IntRect& content_rect, Gfx::Bitmap& target)
     Gfx::Painter painter(target);
     Gfx::IntRect bitmap_rect { {}, content_rect.size() };
 
-    auto* document = page().top_level_browsing_context().active_document();
-    VERIFY(document);
-    document->update_layout();
+    if (auto* document = page().top_level_browsing_context().active_document())
+        document->update_layout();
 
     auto* layout_root = this->layout_root();
     if (!layout_root) {