]> source.dussan.org Git - poi.git/commitdiff
XSLF - fixed NPE when adding pictures with existing non-picture media files (e.g...
authorAndreas Beeker <kiwiwings@apache.org>
Fri, 5 Feb 2016 22:03:44 +0000 (22:03 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Fri, 5 Feb 2016 22:03:44 +0000 (22:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1728737 13f79535-47bb-0310-9956-ffa450edef68

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

index 935d12331e4b92d3e98703cab247a6713416623d..3431d1c241f58204b675aba21a67f9db5eaa1f69 100644 (file)
@@ -163,7 +163,13 @@ public final class XSLFPictureData extends POIXMLDocumentPart implements Picture
             byte data[] = getData();
             checksum = IOUtils.calculateChecksum(data);
             
-            switch (getType()) {
+            PictureType pt = getType();
+            if (pt == null) {
+                origSize = new Dimension(1,1);
+                return;
+            }
+            
+            switch (pt) {
             case EMF:
                 origSize = new EMF.NativeHeader(data, 0).getSize();
                 break;