]> source.dussan.org Git - poi.git/commitdiff
changed to bouncer pattern - to match also the rest of the code
authorAndreas Beeker <kiwiwings@apache.org>
Mon, 17 Dec 2018 10:36:22 +0000 (10:36 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Mon, 17 Dec 2018 10:36:22 +0000 (10:36 +0000)
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

src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java

index ed11a6b19752593991f0e5af0671f1caa6f08128..07b2f01726ce6de1ed3efa7bb8928c2c7c70c683 100644 (file)
@@ -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;