basegfx/source/polygon/b2dtrapezoid.cxx | 3 +++ 1 file changed, 3 insertions(+)
New commits: commit 29d795b772cb75ee1d12cc6bcd4d905f1c520a79 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 23 08:44:10 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Feb 23 12:48:27 2023 +0000 avoid div/0 in getCutPointForGivenY Change-Id: I8e5e5689ee11777938ca7d0268b8e04e77466734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147496 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index b7991dbf55d4..2870c46d8236 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -174,6 +174,9 @@ namespace basegfx::trapezoidhelper // method for cut support B2DPoint getCutPointForGivenY(double fGivenY) const { + // avoid div/0 + if (getDeltaY() == 0) + return B2DPoint(getStart().getX(), fGivenY); // Calculate cut point locally (do not use interpolate) since it is numerically // necessary to guarantee the new, equal Y-coordinate const double fFactor((fGivenY - getStart().getY()) / getDeltaY());