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
This commit is contained in:
Andreas Beeker 2016-02-05 22:03:44 +00:00
parent fb07d95b55
commit ce22cc44c4

View File

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