summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-02-23 08:44:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-02-23 12:48:27 +0000
commit29d795b772cb75ee1d12cc6bcd4d905f1c520a79 (patch)
tree3ef762b4fb8789138ee00614826f8143c1c2c646 /basegfx
parent11c69c57f045f364dd7466f49d9de5408b6a02b4 (diff)
avoid div/0 in getCutPointForGivenY
Change-Id: I8e5e5689ee11777938ca7d0268b8e04e77466734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147496 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dtrapezoid.cxx3
1 files changed, 3 insertions, 0 deletions
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());