sw/source/core/layout/fly.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a23922ecc0072aa52bd2143113ad971b6aef467a
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Apr 18 15:50:24 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Apr 19 12:14:16 2023 +0200

    sw: fix divide by 0 in SwFlyFrame::CalcRel
    
    https: 
//crashreport.libreoffice.org/stats/signature/SwFlyFrame::CalcRel(SwFormatFrameSize%20const%20&)
    Change-Id: If7a1919a2829bbec3292b3aa5f7f719c5ba0beef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150579
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit 6f36e44f248c8e3705779d6692daaf79865a1378)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150567
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 9c61e5590e0a..99f976eab6d7 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2578,12 +2578,12 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize &rSz 
) const
         if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 
SwFormatFrameSize::SYNCED )
             aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 );
 
-        if ( rSz.GetWidthPercent() == SwFormatFrameSize::SYNCED )
+        if ( rSz.GetHeight() && rSz.GetWidthPercent() == 
SwFormatFrameSize::SYNCED )
         {
             aRet.setWidth( aRet.Width() * ( aRet.Height()) );
             aRet.setWidth( aRet.Width() / ( rSz.GetHeight()) );
         }
-        else if ( rSz.GetHeightPercent() == SwFormatFrameSize::SYNCED )
+        else if ( rSz.GetWidth() && rSz.GetHeightPercent() == 
SwFormatFrameSize::SYNCED )
         {
             aRet.setHeight( aRet.Height() * ( aRet.Width()) );
             aRet.setHeight( aRet.Height() / ( rSz.GetWidth()) );

Reply via email to