mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
Avoid some more NPEs on slightly broken documents
This commit is contained in:
parent
58ac8d05f0
commit
8df367310c
@ -58,7 +58,6 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTextLineBreak;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.STTextStrikeType;
|
import org.openxmlformats.schemas.drawingml.x2006.main.STTextStrikeType;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType;
|
import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.impl.CTSRgbColorImpl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a run of text within the containing text body. The run element is the
|
* Represents a run of text within the containing text body. The run element is the
|
||||||
@ -815,6 +814,9 @@ public class XSLFTextRun implements TextRun, HighlightColorSupport {
|
|||||||
if (typeface.startsWith("+mj-") || typeface.startsWith("+mn-")) {
|
if (typeface.startsWith("+mj-") || typeface.startsWith("+mn-")) {
|
||||||
// "+mj-lt".equals(typeface) || "+mn-lt".equals(typeface)
|
// "+mj-lt".equals(typeface) || "+mn-lt".equals(typeface)
|
||||||
final XSLFTheme theme = _p.getParentShape().getSheet().getTheme();
|
final XSLFTheme theme = _p.getParentShape().getSheet().getTheme();
|
||||||
|
if (theme == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
CTFontScheme fontTheme = theme.getXmlObject().getThemeElements().getFontScheme();
|
CTFontScheme fontTheme = theme.getXmlObject().getThemeElements().getFontScheme();
|
||||||
CTFontCollection coll = typeface.startsWith("+mj-")
|
CTFontCollection coll = typeface.startsWith("+mj-")
|
||||||
? fontTheme.getMajorFont() : fontTheme.getMinorFont();
|
? fontTheme.getMajorFont() : fontTheme.getMinorFont();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user