summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-08-12 14:17:05 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-08-12 14:17:05 +0200
commitc1c142dc64f96791ebbaf03caeb3ff1852a7598f (patch)
treea8b50c85bf2f3fc97f8029f0cbf1372d11602950 /chart2
parent68c6408b1725a8f506a8adb8c9af67a65e667f1c (diff)
Avoid division by zero
Change-Id: I283101cdb9b2801880b116064389beb65bd5712a
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
index 2ad533da04e3..f55381012c95 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) );
}
}