diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-25 09:07:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-25 13:10:53 +0200 |
commit | faf2bd9c695733fb1414c094ace01c9b123aa9ca (patch) | |
tree | 54cfc33afa4816ec36d31ede30fd3cdb6ca29749 /filter | |
parent | a24a659d97504a7782574335dd8d1307d727119d (diff) |
ofz#3790 Divide-by-zero
Change-Id: Id6c1eb3dcf95e9cdc68c0898dc472aaac5d430d2
Reviewed-on: https://gerrit.libreoffice.org/43807
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.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx index d2c155ee25be..b079403e691b 100644 --- a/filter/source/graphicfilter/icgm/class4.cxx +++ b/filter/source/graphicfilter/icgm/class4.cxx @@ -512,8 +512,10 @@ void CGM::ImplDoClass4() ImplMapDouble( aRadius.X ); aRadius.Y = aRadius.X; - fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308; - fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308; + const double fStartSqrt = sqrt(vector[0] * vector[ 0 ] + vector[1] * vector[1]); + fStartAngle = fStartSqrt != 0.0 ? (acos(vector[0] / fStartSqrt) * 57.29577951308) : 0.0; + const double fEndSqrt = sqrt(vector[2] * vector[ 2 ] + vector[3] * vector[3]); + fEndAngle = fEndSqrt != 0.0 ? (acos(vector[ 2 ] / fEndSqrt) * 57.29577951308) : 0.0; if ( vector[ 1 ] > 0 ) fStartAngle = 360 - fStartAngle; |