From: Dominik Stadler Date: Mon, 18 Jan 2016 19:56:30 +0000 (+0000) Subject: Fix possible NullPointerException with invalid/unsupported image types X-Git-Tag: REL_3_14_FINAL~67 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5fd6d81f7da6b0f8fe877a824f4b4c2f08e183c2;p=poi.git Fix possible NullPointerException with invalid/unsupported image types git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1725332 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/sl/draw/DrawPaint.java b/src/java/org/apache/poi/sl/draw/DrawPaint.java index 94001fd88c..8d5648f852 100644 --- a/src/java/org/apache/poi/sl/draw/DrawPaint.java +++ b/src/java/org/apache/poi/sl/draw/DrawPaint.java @@ -27,6 +27,7 @@ import java.awt.RadialGradientPaint; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; @@ -145,8 +146,13 @@ public class DrawPaint { renderer.setAlpha(alpha/100000.f); } + BufferedImage image = renderer.getImage(); + if(image == null) { + LOG.log(POILogger.ERROR, "Can't load image data"); + return null; + } Rectangle2D textAnchor = shape.getAnchor(); - Paint paint = new java.awt.TexturePaint(renderer.getImage(), textAnchor); + Paint paint = new java.awt.TexturePaint(image, textAnchor); return paint; } diff --git a/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt b/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt new file mode 100755 index 0000000000..b3f01ed281 Binary files /dev/null and b/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt differ