summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2021-01-06 09:10:35 +0000
committerDominik Stadler <centic@apache.org>2021-01-06 09:10:35 +0000
commit7aa6b06085272f174a82a1a69852c7e1eb5def36 (patch)
tree50b16da6fae552f2a6a611d07f40174468a7f67a /src
parenta2fa70b15d54ec42f0643ef5dc645628171709ec (diff)
downloadpoi-7aa6b06085272f174a82a1a69852c7e1eb5def36.tar.gz
poi-7aa6b06085272f174a82a1a69852c7e1eb5def36.zip
Try to avoid error "Start point cannot equalendpoint"
Happened when trying to apply a gradient to an empty text, let's use at least 1 gradient step always to avoid this. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885191 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/poi/sl/draw/PathGradientPaint.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/java/org/apache/poi/sl/draw/PathGradientPaint.java b/src/java/org/apache/poi/sl/draw/PathGradientPaint.java
index c7d3cfbb67..40c802ccac 100644
--- a/src/java/org/apache/poi/sl/draw/PathGradientPaint.java
+++ b/src/java/org/apache/poi/sl/draw/PathGradientPaint.java
@@ -173,7 +173,9 @@ public class PathGradientPaint implements Paint {
lower = mid;
}
}
- return upper;
+
+ // always report at least one gradient step
+ return Math.max(upper, 1);
}
public WritableRaster createRaster() {