diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-07-06 21:57:36 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-07-06 21:57:36 +0200 |
commit | 388041695d9626970b0d4dce89241c849eeffd0e (patch) | |
tree | 73b505f25ad7e60f5d7a48d6f9500fb2ef784af9 /sfx2 | |
parent | 972fbddf80510f7daaf2128dbfda01c0e7535020 (diff) |
Avoid division by zero
...as seen at <https://ci.libreoffice.org/job/lo_ubsan/593/console>
Change-Id: I5eda975323f96251c72562f9ac6a0ada7a7c7959
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appmisc.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
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, |