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

New commits:
commit be7ce49f33035fcd289a5ffc7a2307bd9a566780
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Apr 18 14:37:32 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Apr 18 16:55:52 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 <caol...@redhat.com>
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 7073ce1bd34a..65f434d45961 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