aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2019-03-02 12:28:19 +0000
committerDominik Stadler <centic@apache.org>2019-03-02 12:28:19 +0000
commita9b2a8b2bd6e93ba85984be9a2aa8f9ac991c968 (patch)
tree20d3e5befc91d841ec77c54e09496e845d0c43a9 /src/java/org/apache/poi
parent53a30d796e27cf44eff2fdecf173b42e89430f61 (diff)
downloadpoi-a9b2a8b2bd6e93ba85984be9a2aa8f9ac991c968.tar.gz
poi-a9b2a8b2bd6e93ba85984be9a2aa8f9ac991c968.zip
Bug 63200: Avoid NullPointerException in XSLFShape.selectPaint() and check some more in integration tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1854639 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi')
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawPaint.java5
1 files changed, 4 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 4fda618d0e..f012161b3c 100644
--- a/src/java/org/apache/poi/sl/draw/DrawPaint.java
+++ b/src/java/org/apache/poi/sl/draw/DrawPaint.java
@@ -407,7 +407,10 @@ public class DrawPaint {
// snapToAnchor(p2, anchor);
// gradient paint on the same point throws an exception ... and doesn't make sense
- return (p1.equals(p2)) ? null : safeFractions((f,c)->new LinearGradientPaint(p1,p2,f,c), fill);
+ // also having less than two fractions will not work
+ return (p1.equals(p2) || fill.getGradientFractions().length < 2) ?
+ null :
+ safeFractions((f,c)->new LinearGradientPaint(p1,p2,f,c), fill);
}