aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2018-12-17 09:17:29 +0000
committerPJ Fanning <fanningpj@apache.org>2018-12-17 09:17:29 +0000
commitbb7ffebe0fed98a4376a937277ed1d0e59f21522 (patch)
tree0ae25cabd4d040630be185f393239fcbb8ce7f49
parent9f7520e86fe51681fa9f7e2bb1edf33d146b7266 (diff)
downloadpoi-bb7ffebe0fed98a4376a937277ed1d0e59f21522.tar.gz
poi-bb7ffebe0fed98a4376a937277ed1d0e59f21522.zip
add null check in XLSFPictureShape
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849069 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
index 01f903e193..ed11a6b197 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
@@ -265,28 +265,28 @@ public class XSLFPictureShape extends XSLFSimpleShape
public XSLFPictureData getSvgImage() {
CTBlip blip = getBlip();
- CTOfficeArtExtensionList extLst = blip.getExtLst();
- if (extLst == null) {
- return null;
- }
+ if (blip != null) {
+ CTOfficeArtExtensionList extLst = blip.getExtLst();
+ if (extLst == null) {
+ return null;
+ }
- int size = extLst.sizeOfExtArray();
- for (int i=0; i<size; i++) {
- XmlCursor cur = extLst.getExtArray(i).newCursor();
- try {
- if (cur.toChild(SVG_NS, "svgBlip")) {
- String svgRelId = cur.getAttributeText(new QName(CORE_PROPERTIES_ECMA376_NS, "embed"));
- return (svgRelId != null) ? (XSLFPictureData)getSheet().getRelationById(svgRelId) : null;
+ int size = extLst.sizeOfExtArray();
+ for (int i = 0; i < size; i++) {
+ XmlCursor cur = extLst.getExtArray(i).newCursor();
+ try {
+ if (cur.toChild(SVG_NS, "svgBlip")) {
+ String svgRelId = cur.getAttributeText(new QName(CORE_PROPERTIES_ECMA376_NS, "embed"));
+ return (svgRelId != null) ? (XSLFPictureData) getSheet().getRelationById(svgRelId) : null;
+ }
+ } finally {
+ cur.dispose();
}
- } finally {
- cur.dispose();
}
}
-
return null;
}
-
/**
* Convienence method for adding SVG images, which generates the preview image
* @param sheet the sheet to add