diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-04-18 15:50:24 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-04-18 21:02:03 +0200 |
commit | 6f36e44f248c8e3705779d6692daaf79865a1378 (patch) | |
tree | 758c5c12705ba6ac8a357c71fbcee694c02ab7a6 /sw | |
parent | c27946fb157fe46fbfaefbe93f2c6794b1af4411 (diff) |
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 <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/layout/fly.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 47a82a228a1f..ee05db8e30ad 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2735,12 +2735,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()) ); |