You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/08/15 16:05:32 UTC

svn commit: r1756397 - /poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java

Author: onealj
Date: Mon Aug 15 16:05:32 2016
New Revision: 1756397

URL: http://svn.apache.org/viewvc?rev=1756397&view=rev
Log:
bug 60005: fix NPE in XSLFTextParagraph.getDefaultFontSize()

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java?rev=1756397&r1=1756396&r2=1756397&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java Mon Aug 15 16:05:32 2016
@@ -752,6 +752,10 @@ public class XSLFTextParagraph implement
     }
 
 
+    /**
+     * @return master style text paragraph properties, or <code>null</code> if 
+     * there are no master slides or the master slides do not contain a text paragraph
+     */
     /* package */ CTTextParagraphProperties getDefaultMasterStyle(){
         CTPlaceholder ph = _shape.getCTPlaceholder();
         String defaultStyleSelector;  
@@ -932,7 +936,11 @@ public class XSLFTextParagraph implement
     public Double getDefaultFontSize() {
         CTTextCharacterProperties endPr = _p.getEndParaRPr();
         if (endPr == null || !endPr.isSetSz()) {
-            endPr = getDefaultMasterStyle().getDefRPr();
+            // inherit the font size from the master style
+            CTTextParagraphProperties masterStyle = getDefaultMasterStyle();
+            if (masterStyle != null) {
+                endPr = masterStyle.getDefRPr();
+            }
         }
         return (endPr == null || !endPr.isSetSz()) ? 12 : (endPr.getSz() / 100.);
     }
@@ -1068,4 +1076,4 @@ public class XSLFTextParagraph implement
     protected XSLFTextRun newTextRun(CTRegularTextRun r) {
         return new XSLFTextRun(r, this);
     }
-}
\ No newline at end of file
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org