summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-04-18 14:37:32 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-04-19 12:12:37 +0200
commit99f43923b66a98b75c78a50577f19293aa480998 (patch)
tree2a57d1f424a54ae37175fbc41c79959c383d1a24
parent6fca3652db1dce0c9221fa112b134eeb0451b3ad (diff)
sw: fix divide by 0
See https://crashreport.libreoffice.org/stats/signature/operator/(Fraction%20const%20&,Fraction%20const%20&) Change-Id: Ia93e2969d6eb0bde71c8419f2aa90bb7aa231f61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150553 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit d01dae0cbabc27f2ff2a242316206067cff73cf8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150563 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 6a17c6e80458..fdf3f6082587 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -900,8 +900,13 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
}
else
{
- aArea.Width ( tools::Long( aArea.Width() / pCli->GetScaleWidth() ) );
- aArea.Height( tools::Long( aArea.Height() / pCli->GetScaleHeight() ) );
+ tools::Long nWidth(pCli->GetScaleWidth());
+ tools::Long nHeight(pCli->GetScaleHeight());
+ if (nWidth && nHeight)
+ {
+ aArea.Width ( aArea.Width() / nWidth );
+ aArea.Height( aArea.Height() / nHeight );
+ }
}
pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );