Skip to content

Commit

Permalink
Bug 1879441: Added null check for selections in nsINode::IsSelected()…
Browse files Browse the repository at this point in the history
…. a=diannaS

Selections are stored here as WeakPtr to save refcount overhead, which means that a selection can be null.

Original Revision: https://phabricator.services.mozilla.com/D202143

Differential Revision: https://phabricator.services.mozilla.com/D202146
  • Loading branch information
jnjaeschke committed Feb 20, 2024
1 parent d39ae92 commit d9bf838
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dom/base/nsINode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ bool nsINode::IsSelected(const uint32_t aStartOffset,
// Looks like that IsInSelection() assert fails sometimes...
if (range->IsInAnySelection()) {
for (const WeakPtr<Selection>& selection : range->GetSelections()) {
ancestorSelections.Insert(selection);
if (selection) {
ancestorSelections.Insert(selection);
}
}
}
}
Expand Down

0 comments on commit d9bf838

Please sign in to comment.