From: Andreas Beeker Date: Fri, 5 Feb 2016 22:03:44 +0000 (+0000) Subject: XSLF - fixed NPE when adding pictures with existing non-picture media files (e.g... X-Git-Tag: REL_3_14_FINAL~48 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f2a8846bd4969450f39e335e638c13f59cba1ff3;p=poi.git XSLF - fixed NPE when adding pictures with existing non-picture media files (e.g. movies) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1728737 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java index 935d12331e..3431d1c241 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java @@ -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;