diff --git a/dom/base/nsContentList.h b/dom/base/nsContentList.h index 90cb25334873..4798d10eb5d3 100644 --- a/dom/base/nsContentList.h +++ b/dom/base/nsContentList.h @@ -52,10 +52,13 @@ class nsBaseContentList : public nsINodeList { NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsBaseContentList) void AppendElement(nsIContent* aContent) { + MOZ_ASSERT(aContent); mElements.AppendElement(aContent); } void MaybeAppendElement(nsIContent* aContent) { - if (aContent) AppendElement(aContent); + if (aContent) { + AppendElement(aContent); + } } /** diff --git a/layout/inspector/InspectorUtils.cpp b/layout/inspector/InspectorUtils.cpp index 57f4bb583e7d..95abea8f3561 100644 --- a/layout/inspector/InspectorUtils.cpp +++ b/layout/inspector/InspectorUtils.cpp @@ -769,7 +769,7 @@ static void AddOverflowingChildrenOfElement(const nsIFrame* aFrame, if (FrameHasSpecifiedSize(child) && IsFrameOutsideOfAncestor(child, aAncestorFrame, aRect)) { - aList.AppendElement(child->GetContent()); + aList.MaybeAppendElement(child->GetContent()); continue; } @@ -780,7 +780,7 @@ static void AddOverflowingChildrenOfElement(const nsIFrame* aFrame, // calling AddOverflowingChildrenOfElement on it. if (currListLength == aList.Length() && IsFrameOutsideOfAncestor(child, aAncestorFrame, aRect)) { - aList.AppendElement(child->GetContent()); + aList.MaybeAppendElement(child->GetContent()); } } }