REGRESSION(180076): [Mac, iOS] Correct possible null dereference in printing code
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Apr 2015 02:26:07 +0000 (02:26 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Apr 2015 02:26:07 +0000 (02:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144366
<rdar://problem/20533513>

Reviewed by Dean Jackson.

* rendering/RenderBlockFlow.cpp:
(WebCore::needsAppleMailPaginationQuirk): Check if the document settings is a nullptr
before attempting to dereference it.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183524 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlockFlow.cpp

index 944cdbf..09fe48a 100644 (file)
@@ -1,3 +1,15 @@
+2015-04-28  Brent Fulgham  <bfulgham@apple.com>
+
+        REGRESSION(180076): [Mac, iOS] Correct possible null dereference in printing code
+        https://bugs.webkit.org/show_bug.cgi?id=144366
+        <rdar://problem/20533513>
+
+        Reviewed by Dean Jackson.
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::needsAppleMailPaginationQuirk): Check if the document settings is a nullptr
+        before attempting to dereference it. 
+
 2015-04-28  Andreas Kling  <akling@apple.com>
 
         Simplify DOM wrapper destruction, don't deref() in finalizers.
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;