summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-09-16 12:33:07 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-09-19 15:03:45 +0200
commit0df8551042fa193a52718ea2f62f7164f3f42bdf (patch)
tree0f4b27ede0ccc7480ac50675f49548964acee975
parentupgrade to libwebp-1.2.4 (diff)
downloadcore-0df8551042fa193a52718ea2f62f7164f3f42bdf.tar.gz
core-0df8551042fa193a52718ea2f62f7164f3f42bdf.zip
tdf#150987 calc crash pasting content
regression from commit d0119ff7f2c68aa05286bd303128f3a69c6bbd6a improve tools::Rectangle->basegfx::B2?Rectangle conversion which resulted in Fraction throwing an exception because of divide-by-zero Change-Id: I90a92a644c5fb40e9b93237c79f6760d4bb73d0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140064 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit ab5928517639e49dbcab2c2de195849d611124b9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139990 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--svx/source/svdraw/svdoole2.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 4582c6e34b37..7bc3ee34e0d2 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1470,8 +1470,10 @@ void SdrOle2Obj::ImpSetVisAreaSize()
// objects' visual area. The scaling will not change, but it might exist already and must
// be used in calculations
MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( mpImpl->mxObjRef->getMapUnit( GetAspect() ) );
- Size aVisSize( static_cast<tools::Long>( Fraction( maRect.GetWidth() ) / aScaleWidth ),
- static_cast<tools::Long>( Fraction( maRect.GetHeight() ) / aScaleHeight ) );
+ Size aVisSize;
+ if (sal_Int32(aScaleWidth) != 0 && sal_Int32(aScaleHeight) != 0) // avoid div by zero
+ aVisSize = Size( static_cast<tools::Long>( Fraction( maRect.GetWidth() ) / aScaleWidth ),
+ static_cast<tools::Long>( Fraction( maRect.GetHeight() ) / aScaleHeight ) );
aVisSize = OutputDevice::LogicToLogic(
aVisSize,