Commit 96db3c2e authored by George Steel's avatar George Steel Committed by Commit Bot

Add null check to RemovePreviouslySelectedEmptyTableRow().

Add DCHECK(this) to node::IsDescendantOf() to get better stack trace
in ClusterFuzz when it is called on nullptr.

Bug: 1035664
Change-Id: I09d66f770eac7c231a8f6ef9b4840a826caf7971
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2019469Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Commit-Queue: George Steel <gtsteel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735969}
parent 14bf779d
......@@ -1528,6 +1528,8 @@ void Node::ClearFlatTreeNodeDataIfHostChanged(const ContainerNode& parent) {
}
bool Node::IsDescendantOf(const Node* other) const {
DCHECK(this); // Necessary for clusterfuzz tooling to get a useful backtrace
// Return true if other is an ancestor of this, otherwise false
if (!other || isConnected() != other->isConnected())
return false;
......
......@@ -975,7 +975,8 @@ void DeleteSelectionCommand::RemovePreviouslySelectedEmptyTableRows(
if (IsTableRowEmpty(end_table_row_.Get())) {
// Don't remove end_table_row_ if it's where we're putting the ending
// selection.
if (!ending_position_.AnchorNode()->IsDescendantOf(
if (ending_position_.IsNull() ||
!ending_position_.AnchorNode()->IsDescendantOf(
end_table_row_.Get())) {
// FIXME: We probably shouldn't remove end_table_row_ unless it's
// fully selected, even if it is empty. We'll need to start
......
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