Commit 47d91ead authored by Sarthak Shah's avatar Sarthak Shah Committed by Commit Bot

Fix a NULL-dereference Read Crash

Currently, trying to start selection autoscroll results in a crash if
layout object does not exist or is deleted.

This CL fixes this issue by adding a null check before trying to start
autoscroll for selection.

Bug: 1023249
Change-Id: I0bb81e865372077e2d34b95df4172c1283679201
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1912682Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Sarthak Shah <sarsha@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#714742}
parent 7c121be8
...@@ -1581,12 +1581,14 @@ void HTMLSelectElement::ListBoxDefaultEventHandler(Event& event) { ...@@ -1581,12 +1581,14 @@ void HTMLSelectElement::ListBoxDefaultEventHandler(Event& event) {
!mouse_event.ButtonDown()) !mouse_event.ButtonDown())
return; return;
if (LayoutObject* object = GetLayoutObject()) LayoutObject* layout_object = GetLayoutObject();
object->GetFrameView()->UpdateAllLifecyclePhasesExceptPaint(); if (layout_object) {
layout_object->GetFrameView()->UpdateAllLifecyclePhasesExceptPaint();
if (Page* page = GetDocument().GetPage()) { if (Page* page = GetDocument().GetPage()) {
page->GetAutoscrollController().StartAutoscrollForSelection( page->GetAutoscrollController().StartAutoscrollForSelection(
GetLayoutObject()); layout_object);
}
} }
// Mousedown didn't happen in this element. // Mousedown didn't happen in this element.
if (last_on_change_selection_.IsEmpty()) if (last_on_change_selection_.IsEmpty())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment