From: Andreas Beeker Date: Mon, 17 Dec 2018 10:36:22 +0000 (+0000) Subject: changed to bouncer pattern - to match also the rest of the code X-Git-Tag: REL_4_1_0~180 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3452ea963da37d9641ae5a2076ff244f13686344;p=poi.git changed to bouncer pattern - to match also the rest of the code see https://softwareengineering.stackexchange.com/questions/18454/should-i-return-from-a-function-early-or-use-an-if-statement git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849074 13f79535-47bb-0310-9956-ffa450edef68 --- 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 ed11a6b197..07b2f01726 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java @@ -265,23 +265,24 @@ public class XSLFPictureShape extends XSLFSimpleShape public XSLFPictureData getSvgImage() { CTBlip blip = getBlip(); - if (blip != null) { - CTOfficeArtExtensionList extLst = blip.getExtLst(); - if (extLst == null) { - return null; - } + if (blip == null) { + return 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; - } - } finally { - cur.dispose(); + 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(); } } return null;