[Libreoffice-commits] core.git: sfx2/source
Stephan Bergmann
sbergman at redhat.com
Thu Jul 6 19:58:42 UTC 2017
sfx2/source/appl/appmisc.cxx | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
New commits:
commit 388041695d9626970b0d4dce89241c849eeffd0e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Jul 6 21:57:36 2017 +0200
Avoid division by zero
...as seen at <https://ci.libreoffice.org/job/lo_ubsan/593/console>
Change-Id: I5eda975323f96251c72562f9ac6a0ada7a7c7959
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx
index 6fda9dd336c3..262cae606bad 100644
--- a/sfx2/source/appl/appmisc.cxx
+++ b/sfx2/source/appl/appmisc.cxx
@@ -147,14 +147,16 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid
// transform into [0,0,width,width*aspect] std dimensions
basegfx::B2DRange aRange(aSvgData.getRange());
- const double fAspectRatio(aRange.getWidth()/aRange.getHeight());
+ const double fAspectRatio(
+ aRange.getHeight() == 0.0 ? 1.0 : aRange.getWidth()/aRange.getHeight());
basegfx::B2DHomMatrix aTransform(
basegfx::tools::createTranslateB2DHomMatrix(
-aRange.getMinX(),
-aRange.getMinY()));
aTransform.scale(
- nWidth / aRange.getWidth(),
- nWidth / fAspectRatio / aRange.getHeight());
+ aRange.getWidth() == 0.0 ? 1.0 : nWidth / aRange.getWidth(),
+ (aRange.getHeight() == 0.0
+ ? 1.0 : nWidth / fAspectRatio / aRange.getHeight()));
const drawinglayer::primitive2d::Primitive2DReference xTransformRef(
new drawinglayer::primitive2d::TransformPrimitive2D(
aTransform,
More information about the Libreoffice-commits
mailing list