From 8cdcda2873e057cfe48a6abcb43066ed9dbb5195 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 11 Jan 2026 20:12:33 +0100 Subject: [PATCH] Avoid NPE when handling color-highlighting in text-runs --- .../main/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java | 4 ++++ 1 file changed, 4 insertions(+) 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 b909704d24..a0be4a8a97 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 @@ -191,6 +191,10 @@ public class XSLFTextRun implements TextRun, HighlightColorSupport { } final CTSRgbColor rgbCol = col.getSrgbClr(); + if (rgbCol == null) { + return; + } + final byte[] cols = rgbCol.getVal(); final SolidPaint paint = DrawPaint.createSolidPaint(new Color(0xFF & cols[0], 0xFF & cols[1], 0xFF & cols[2])); highlightColor.accept(paint);