mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibHTML: Don't crash when calling set_document(nullptr)
This commit is contained in:
parent
edbf09ea29
commit
6287c2b270
Notes:
sideshowbarker
2024-07-19 11:45:35 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6287c2b270d
1 changed files with 8 additions and 5 deletions
|
@ -36,11 +36,14 @@ void HtmlView::set_document(Document* document)
|
|||
m_document->on_invalidate_layout = nullptr;
|
||||
|
||||
m_document = document;
|
||||
m_document->on_invalidate_layout = [this]() {
|
||||
m_layout_root = m_document->create_layout_tree(m_document->style_resolver(), nullptr);
|
||||
layout_and_sync_size();
|
||||
update();
|
||||
};
|
||||
|
||||
if (m_document) {
|
||||
m_document->on_invalidate_layout = [this]() {
|
||||
m_layout_root = m_document->create_layout_tree(m_document->style_resolver(), nullptr);
|
||||
layout_and_sync_size();
|
||||
update();
|
||||
};
|
||||
}
|
||||
|
||||
main_frame().set_document(document);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue