From 8aa24c45dd3ebc7c53670268cfb27a0fdb949faf Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 14 Mar 2022 23:07:38 +0100 Subject: [PATCH] LibWeb: Make BrowsingContext::reset_cursor_blink_cycle() more robust If the browsing context text cursor has become invalid for whatever reason, don't try to repaint its associated node. --- Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index 66b18d9bc1..9291176ce9 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -54,7 +54,8 @@ void BrowsingContext::reset_cursor_blink_cycle() { m_cursor_blink_state = true; m_cursor_blink_timer->restart(); - m_cursor_position.node()->layout_node()->set_needs_display(); + if (m_cursor_position.is_valid() && m_cursor_position.node()->layout_node()) + m_cursor_position.node()->layout_node()->set_needs_display(); } // https://html.spec.whatwg.org/multipage/browsers.html#top-level-browsing-context