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

Stephan Bergmann sbergman at redhat.com
Wed Aug 12 05:17:27 PDT 2015


 chart2/source/controller/chartapiwrapper/LegendWrapper.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c1c142dc64f96791ebbaf03caeb3ff1852a7598f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 12 14:17:05 2015 +0200

    Avoid division by zero
    
    Change-Id: I283101cdb9b2801880b116064389beb65bd5712a

diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
index 2ad533d..f553810 100644
--- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
@@ -302,8 +302,8 @@ void SAL_CALL LegendWrapper::setPosition( const awt::Point& aPosition )
 
         chart2::RelativePosition aRelativePosition;
         aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
-        aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
-        aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
+        aRelativePosition.Primary = aPageSize.Width == 0 ? 0 : double(aPosition.X)/double(aPageSize.Width);
+        aRelativePosition.Secondary = aPageSize.Height == 0 ? 0 : double(aPosition.Y)/double(aPageSize.Height);
         xProp->setPropertyValue( "RelativePosition", uno::makeAny(aRelativePosition) );
     }
 }


More information about the Libreoffice-commits mailing list