From 7aa6b06085272f174a82a1a69852c7e1eb5def36 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Wed, 6 Jan 2021 09:10:35 +0000 Subject: [PATCH] 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 --- src/java/org/apache/poi/sl/draw/PathGradientPaint.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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() { -- 2.39.5