REGRESSION(180076): [Mac, iOS] Correct possible null dereference in printing code
[WebKit-https.git] / Source / WebCore / rendering / RenderBlockFlow.cpp
index e832038..d340d8e 100644 (file)
@@ -1612,8 +1612,15 @@ static inline LayoutUnit calculateMinimumPageHeight(RenderStyle& renderStyle, Ro
 
 static inline bool needsAppleMailPaginationQuirk(RootInlineBox& lineBox)
 {
-    bool appleMailPaginationQuirkEnabled = lineBox.renderer().document().settings()->appleMailPaginationQuirkEnabled();
-    if (appleMailPaginationQuirkEnabled && lineBox.renderer().element() && lineBox.renderer().element()->idForStyleResolution() == AtomicString("messageContentContainer", AtomicString::ConstructFromLiteral))
+    const auto& renderer = lineBox.renderer();
+
+    if (!renderer.document().settings())
+        return false;
+
+    if (!renderer.document().settings()->appleMailPaginationQuirkEnabled())
+        return false;
+
+    if (renderer.element() && renderer.element()->idForStyleResolution() == AtomicString("messageContentContainer", AtomicString::ConstructFromLiteral))
         return true;
 
     return false;