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

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

commit 521b26fad979c1992538584c199fc75f2a1fd7aa
Author: Dominik Stadler <[email protected]>
AuthorDate: Sun Nov 1 18:35:57 2026 +0100

    Prevent NPEs when some shape-attributes are missing
---
 .../src/main/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java 
b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java
index 4284d7e815..a311f984b7 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFAutoShape.java
@@ -42,9 +42,10 @@ public class XSLFAutoShape extends XSLFTextShape implements 
AutoShape<XSLFShape,
 
     /* package */
     static XSLFAutoShape create(CTShape shape, XSLFSheet sheet) {
-        if (shape.getSpPr().isSetCustGeom()) {
+        if (shape.getSpPr() != null && shape.getSpPr().isSetCustGeom()) {
             return new XSLFFreeformShape(shape, sheet);
-        } else if (shape.getNvSpPr().getCNvSpPr() != null && 
shape.getNvSpPr().getCNvSpPr().isSetTxBox()) {
+        } else if (shape.getNvSpPr() != null && shape.getNvSpPr().getCNvSpPr() 
!= null &&
+                shape.getNvSpPr().getCNvSpPr().isSetTxBox()) {
             return new XSLFTextBox(shape, sheet);
         } else {
             return new XSLFAutoShape(shape, sheet);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to