sw/source/uibase/wrtsh/wrtsh1.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit cb56f2f504c77c4b68c0d0d213ff1978c4df5f02
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Apr 18 14:37:32 2023 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Wed Apr 26 13:21:41 2023 +0200

    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 <[email protected]>
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit d01dae0cbabc27f2ff2a242316206067cff73cf8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150562
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 59e13bdd6d894f48b73eacd339d0ecfa0be87e74)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150571
    Reviewed-by: Noel Grandin <[email protected]>
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Michael Weghorn <[email protected]>

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index b989343266cb..3ef6559cae34 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -914,8 +914,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 );

Reply via email to