summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-24 16:05:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-25 09:53:52 +0200
commitce3e0b25f5c8cb49fb7ee0b2c2a3c80ace5e4eed (patch)
tree96a5e97413ec5e561ff412e14f5d67fe73db10c5 /filter
parentcd0030e5d6ee7042c3e42028dc1e1d869493d52a (diff)
ofz#3775 Divide-by-zero
Change-Id: Idfbd2bdf10b5fcf54e1fc2a61dbfecabf7e75a6d Reviewed-on: https://gerrit.libreoffice.org/43784 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/graphicfilter/icgm/class4.cxx8
1 files 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;