aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2016-01-18 19:56:30 +0000
committerDominik Stadler <centic@apache.org>2016-01-18 19:56:30 +0000
commit5fd6d81f7da6b0f8fe877a824f4b4c2f08e183c2 (patch)
tree0d0dc1afd05a3f5665b90bb33c7b1949a2849aca
parent313cce7d77fe3e84f911d9553cd4b6169121a523 (diff)
downloadpoi-5fd6d81f7da6b0f8fe877a824f4b4c2f08e183c2.tar.gz
poi-5fd6d81f7da6b0f8fe877a824f4b4c2f08e183c2.zip
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
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawPaint.java8
-rwxr-xr-xtest-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.pptbin0 -> 120833 bytes
2 files changed, 7 insertions, 1 deletions
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
--- /dev/null
+++ b/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt
Binary files differ