You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2026/01/18 17:30:22 UTC

(poi) 01/07: Avoid some more NPEs on slightly broken documents

This is an automated email from the ASF dual-hosted git repository.

centic pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit 8df367310ca8da424759cff7c0a0b0362cb01e1a
Author: Dominik Stadler <do...@gmx.at>
AuthorDate: Sat Jan 17 13:57:26 2026 +0100

    Avoid some more NPEs on slightly broken documents
---
 .../src/main/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java      | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
index a0be4a8a97..f2e5cdc3e9 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
@@ -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.STTextStrikeType;
 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
@@ -815,6 +814,9 @@ public class XSLFTextRun implements TextRun, HighlightColorSupport {
             if (typeface.startsWith("+mj-") || typeface.startsWith("+mn-")) {
                 //  "+mj-lt".equals(typeface) || "+mn-lt".equals(typeface)
                 final XSLFTheme theme = _p.getParentShape().getSheet().getTheme();
+                if (theme == null) {
+                    return null;
+                }
                 CTFontScheme fontTheme = theme.getXmlObject().getThemeElements().getFontScheme();
                 CTFontCollection coll = typeface.startsWith("+mj-")
                     ? fontTheme.getMajorFont() : fontTheme.getMinorFont();


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