bug 60005: fix NPE in XSLFTextParagraph.getDefaultFontSize()

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1756397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-08-15 16:05:32 +00:00
parent 4f49414473
commit 779c0e527a

View File

@ -752,6 +752,10 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
}
/**
* @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 implements TextParagraph<XSLFShape,XSLFTextParagr
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 implements TextParagraph<XSLFShape,XSLFTextParagr
protected XSLFTextRun newTextRun(CTRegularTextRun r) {
return new XSLFTextRun(r, this);
}
}
}