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 befc941dcf7ab1a3537d9bfad0abd6a6284fbb2b
Author: Dominik Stadler <[email protected]>
AuthorDate: Wed Jan 7 19:32:26 2026 +0100

    Avoid NPE with broken files when handling paint-style for fill
---
 .../org/apache/poi/hslf/usermodel/HSLFFill.java     |   7 ++++++-
 .../2100a8d44da546f97ab7795c500a58bed6cb655d.ppt    | Bin 0 -> 9728 bytes
 test-data/spreadsheet/stress.xls                    | Bin 73728 -> 73728 bytes
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java 
b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java
index 3a8c767e6d..9847155d50 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java
@@ -244,7 +244,12 @@ public final class HSLFFill {
 
         if (!FILL_USE_FILLED.isSet(propVal) && masterProp != null) {
             int masterId = masterProp.getPropertyValue();
-            HSLFShape o = 
shape.getSheet().getMasterSheet().getShapes().stream().filter(s -> 
s.getShapeId() == masterId).findFirst().orElse(null);
+            HSLFMasterSheet masterSheet = shape.getSheet().getMasterSheet();
+            if (masterSheet == null) {
+                return null;
+            }
+
+            HSLFShape o = masterSheet.getShapes().stream().filter(s -> 
s.getShapeId() == masterId).findFirst().orElse(null);
             return o != null ? o.getFillStyle().getPaint() : null;
         }
 
diff --git a/test-data/slideshow/2100a8d44da546f97ab7795c500a58bed6cb655d.ppt 
b/test-data/slideshow/2100a8d44da546f97ab7795c500a58bed6cb655d.ppt
new file mode 100644
index 0000000000..56815d6acc
Binary files /dev/null and 
b/test-data/slideshow/2100a8d44da546f97ab7795c500a58bed6cb655d.ppt differ
diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls
index 5bf30b98ef..cfc460f7d9 100644
Binary files a/test-data/spreadsheet/stress.xls and 
b/test-data/spreadsheet/stress.xls differ


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

Reply via email to