diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2023-03-22 17:29:00 +0800 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-03-23 12:18:04 +0100 |
commit | ef7ff8da4ba1d6d3f4d4f634bb74c7f4a1d80594 (patch) | |
tree | 7e50e66acaed90165c2856e4e8de994b60069741 | |
parent | 2733585a3f4aedebf00b7df2869bc81621d0c33a (diff) | |
download | uxp-ef7ff8da4ba1d6d3f4d4f634bb74c7f4a1d80594.tar.gz |
Issue #1592 - Follow-up: Don't post a restyle event if restyleElement is null
This fixes a potential crash caused if restyleElement is null.
-rw-r--r-- | dom/base/ShadowRoot.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index 8482da5e99..abf6301123 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -163,6 +163,7 @@ ShadowRoot::AddSlot(HTMLSlotElement* aSlot) oldSlot->RemoveAssignedNode(assignedNode); currentSlot->AppendAssignedNode(assignedNode); + Element* restyleElement; if (assignedNode->IsElement()) { restyleElement = assignedNode->AsElement(); @@ -170,8 +171,10 @@ ShadowRoot::AddSlot(HTMLSlotElement* aSlot) // This is likely a text node. Use the host instead. restyleElement = GetHost(); } - nsLayoutUtils::PostRestyleEvent( - restyleElement, eRestyle_Subtree, nsChangeHint(0)); + if (restyleElement) { + nsLayoutUtils::PostRestyleEvent( + restyleElement, eRestyle_Subtree, nsChangeHint(0)); + } doEnqueueSlotChange = true; } |