poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1756397 - /poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
Date Mon, 15 Aug 2016 16:05:32 GMT
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


Mime
View raw message