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
This commit is contained in:
Dominik Stadler 2021-01-06 09:10:35 +00:00
parent a2fa70b15d
commit 7aa6b06085
1 changed files with 3 additions and 1 deletions

View File

@ -173,7 +173,9 @@ public class PathGradientPaint implements Paint {
lower = mid; lower = mid;
} }
} }
return upper;
// always report at least one gradient step
return Math.max(upper, 1);
} }
public WritableRaster createRaster() { public WritableRaster createRaster() {