[Libreoffice-commits] core.git: filter/source

Caolán McNamara caolanm at redhat.com
Wed Oct 25 07:54:14 UTC 2017


 filter/source/graphicfilter/icgm/class4.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit ce3e0b25f5c8cb49fb7ee0b2c2a3c80ace5e4eed
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Oct 24 16:05:51 2017 +0100

    ofz#3775 Divide-by-zero
    
    Change-Id: Idfbd2bdf10b5fcf54e1fc2a61dbfecabf7e75a6d
    Reviewed-on: https://gerrit.libreoffice.org/43784
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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;


More information about the Libreoffice-commits mailing list