Bug 1340885 - Null check frame's content when searching for NAC ancestors in GetCorrectedParent. r=xidorn
authorCameron McCormack <cam@mcc.id.au>
Mon, 20 Feb 2017 10:22:13 +0800
changeset 372774 73ce27f80d1a7b512b03939a92bb6315401a76e7
parent 372773 f4c8bd8aa36f19d5cae6198364cd206bbfef2155
child 372775 b41c2c9d9c2b93ee3a3acbfbc9dc89c7704be13c
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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);