]> source.dussan.org Git - poi.git/commitdiff
bug 60005: fix NPE in XSLFTextParagraph.getDefaultFontSize()
authorJaven O'Neal <onealj@apache.org>
Mon, 15 Aug 2016 16:05:32 +0000 (16:05 +0000)
committerJaven O'Neal <onealj@apache.org>
Mon, 15 Aug 2016 16:05:32 +0000 (16:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1756397 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java

index edd17dec5554fc84f96ae4749cfea4ba65e5cab3..c5a2ce069ded361ad49af6c818c70ea4c2f30ff9 100644 (file)
@@ -752,6 +752,10 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
     }\r
 \r
 \r
+    /**\r
+     * @return master style text paragraph properties, or <code>null</code> if \r
+     * there are no master slides or the master slides do not contain a text paragraph\r
+     */\r
     /* package */ CTTextParagraphProperties getDefaultMasterStyle(){\r
         CTPlaceholder ph = _shape.getCTPlaceholder();\r
         String defaultStyleSelector;  \r
@@ -932,7 +936,11 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
     public Double getDefaultFontSize() {\r
         CTTextCharacterProperties endPr = _p.getEndParaRPr();\r
         if (endPr == null || !endPr.isSetSz()) {\r
-            endPr = getDefaultMasterStyle().getDefRPr();\r
+            // inherit the font size from the master style\r
+            CTTextParagraphProperties masterStyle = getDefaultMasterStyle();\r
+            if (masterStyle != null) {\r
+                endPr = masterStyle.getDefRPr();\r
+            }\r
         }\r
         return (endPr == null || !endPr.isSetSz()) ? 12 : (endPr.getSz() / 100.);\r
     }\r
@@ -1068,4 +1076,4 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
     protected XSLFTextRun newTextRun(CTRegularTextRun r) {\r
         return new XSLFTextRun(r, this);\r
     }\r
-}
\ No newline at end of file
+}\r