From 3452ea963da37d9641ae5a2076ff244f13686344 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Mon, 17 Dec 2018 10:36:22 +0000 Subject: [PATCH] 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 --- .../poi/xslf/usermodel/XSLFPictureShape.java | 31 ++++++++++--------- 1 file changed, 16 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 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; -- 2.39.5