ShadowRoot with leading or trailing white space cause a crash
[WebKit-https.git] / Source / WebCore / style / RenderTreePosition.cpp
index af9b9136987e32cb8d20408929c22f393ab282d1..751e33db6e1b047d30db8372761aa5858c449941 100644 (file)
@@ -62,8 +62,10 @@ RenderObject* RenderTreePosition::previousSiblingRenderer(const Text& textNode)
         if (renderer && !RenderTreePosition::isRendererReparented(*renderer))
             return renderer;
     }
-    if (PseudoElement* before = textNode.parentElement()->beforePseudoElement())
-        return before->renderer();
+    if (auto* parent = textNode.parentElement()) {
+        if (auto* before = parent->beforePseudoElement())
+            return before->renderer();
+    }
     return nullptr;
 }