aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2024-04-17 18:15:38 +0000
committerDominik Stadler <centic@apache.org>2024-04-17 18:15:38 +0000
commitc4e8388742ab1e6818306df38aa0095742828f5d (patch)
treea7d298647eb242a0cdf526f24bdc70c5b44b0b62 /poi-ooxml
parent51637fcc435f1a65edd08f30df1d71824b95843c (diff)
downloadpoi-c4e8388742ab1e6818306df38aa0095742828f5d.tar.gz
poi-c4e8388742ab1e6818306df38aa0095742828f5d.zip
Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66386 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1917069 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
index 0ede2c2c5f..18c69b616b 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
@@ -63,9 +63,10 @@ public final class XSSFGraphicFrame extends XSSFShape {
for (int i = 0; i < nodes.getLength(); i++) {
final Node node = nodes.item(i);
// if the frame references a chart, associate the chart with this instance
- if (node.getNodeName().equals("c:chart")) {
+ Node namedItem = node.getAttributes().getNamedItem("r:id");
+ if (node.getNodeName().equals("c:chart") && namedItem != null) {
// this better succeed or the document is invalid
- POIXMLDocumentPart relation = drawing.getRelationById(node.getAttributes().getNamedItem("r:id").getNodeValue());
+ POIXMLDocumentPart relation = drawing.getRelationById(namedItem.getNodeValue());
// Do XWPF charts need similar treatment?
if (relation instanceof XSSFChart) {
((XSSFChart) relation).setGraphicFrame(this);