From: Dominik Stadler Date: Wed, 6 Jan 2021 09:10:35 +0000 (+0000) Subject: Try to avoid error "Start point cannot equalendpoint" X-Git-Tag: REL_5_0_0~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7aa6b06085272f174a82a1a69852c7e1eb5def36;p=poi.git 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 --- 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() {