From ce3e0b25f5c8cb49fb7ee0b2c2a3c80ace5e4eed Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 24 Oct 2017 16:05:51 +0100 Subject: ofz#3775 Divide-by-zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idfbd2bdf10b5fcf54e1fc2a61dbfecabf7e75a6d Reviewed-on: https://gerrit.libreoffice.org/43784 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- filter/source/graphicfilter/icgm/class4.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx index 7699c740f236..813d07b69f4f 100644 --- a/filter/source/graphicfilter/icgm/class4.cxx +++ b/filter/source/graphicfilter/icgm/class4.cxx @@ -28,13 +28,13 @@ using namespace ::com::sun::star; double CGM::ImplGetOrientation( FloatPoint const & rCenter, FloatPoint const & rPoint ) { - double fOrientation; - double nX = rPoint.X - rCenter.X; double nY = rPoint.Y - rCenter.Y; - fOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308; - if ( nY > 0 ) + double fSqrt = sqrt(nX * nX + nY * nY); + + double fOrientation = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0; + if (nY > 0) fOrientation = 360 - fOrientation; return fOrientation; -- cgit v1.2.3