Bug 1340885 - Null check frame's content when searching for NAC ancestors in GetCorrectedParent. r?xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 20 Feb 2017 10:22:13 +0800
changeset 486832 5d7f3330d5aef618c1b7f13de3bfb805b11416c2
parent 486741 16effd5b21ab03629feca04b5b83911bb757394c
child 546325 84768946f78c14a8d662722b6fb55ae8aa5f4986
push id46070
push userbmo:cam@mcc.id.au
push dateMon, 20 Feb 2017 02:22:38 +0000
reviewersxidorn
bugs1340885
milestone54.0a1
Bug 1340885 - Null check frame's content when searching for NAC ancestors in GetCorrectedParent. r?xidorn MozReview-Commit-ID: 7u2yKe8ir1V
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -9100,17 +9100,18 @@ GetCorrectedParent(const nsIFrame* aFram
   // This duplication and complexity will go away when we fully switch to the
   // Servo style system, where all this can be handled much more naturally.
   //
   // We need to take special care not to disrupt the style inheritance of frames
   // whose content is NAC but who implement a pseudo (like an anonymous
   // box, or a non-NAC-backed pseudo like ::first-line) that does not match the
   // one that the NAC implements, if any.
   nsIContent* content = aFrame->GetContent();
-  Element* element = content->IsElement() ? content->AsElement() : nullptr;
+  Element* element =
+    content && content->IsElement() ? content->AsElement() : nullptr;
   if (element && element->IsNativeAnonymous() &&
       element->GetPseudoElementType() == aFrame->StyleContext()->GetPseudoType()) {
     while (parent->GetContent() && parent->GetContent()->IsNativeAnonymous()) {
       parent = parent->GetParent();
     }
   }
 
   return nsFrame::CorrectStyleParentFrame(parent, pseudo);