diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-10-25 15:12:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-10-25 20:13:00 +0200 |
commit | 3e9da1e271c26bd17ab4fe107992e6a03fe865de (patch) | |
tree | 91f21d49fe5f8470a77d521bb7c35029ec5cc690 /svx/source | |
parent | 4bb6533d398cc76d7ff292a9e47dae87fac74f83 (diff) |
ofz#40305 Divide-by-zero
Change-Id: Ib865d880d51d5beef1f235e4a8d5d0c17adf8499
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124153
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape3d.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index b6e3e04234ab..05bb45f4a9cf 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -228,11 +228,11 @@ Point EnhancedCustomShape3d::Transformation2D::Transform2D( const basegfx::B3DPo aPoint2D.setX( static_cast<sal_Int32>(rPoint3D.getX()) ); aPoint2D.setY( static_cast<sal_Int32>(rPoint3D.getY()) ); } - else + else if (double fDiv = rPoint3D.getZ() - fViewPoint.getZ(); fDiv != 0.0) { double fX = rPoint3D.getX() - fOriginX; double fY = rPoint3D.getY() - fOriginY; - double f = ( - fViewPoint.getZ() ) / ( rPoint3D.getZ() - fViewPoint.getZ() ); + double f = ( - fViewPoint.getZ() ) / fDiv; aPoint2D.setX( static_cast<sal_Int32>(( fX - fViewPoint.getX() ) * f + fViewPoint.getX() + fOriginX ) ); aPoint2D.setY( static_cast<sal_Int32>(( fY - fViewPoint.getY() ) * f + fViewPoint.getY() + fOriginY ) ); } |