mirror of https://github.com/apache/poi.git
add null check in XLSFPictureShape
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849069 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9f7520e86f
commit
bb7ffebe0f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue