sw/source/filter/html/htmlgrin.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6a5c8d9609d2d3b1dc4b7f67ea41fb43add9a993
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 17 09:43:34 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Nov 17 14:40:26 2021 +0100

    ofz#41081 divide by zero
    
    and
    
    ofz#41088 divide by zero
    
    Change-Id: Ic545271709257fe5f676446e82b9638b84867195
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125374
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/filter/html/htmlgrin.cxx 
b/sw/source/filter/html/htmlgrin.cxx
index 1d176945394d..582f30caa4f6 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -526,9 +526,9 @@ IMAGE_SETEVENT:
         if (!bHeightProvided)
             nHeight = aPixelSize.Height();
         // tdf#142781 - calculate the width/height keeping the aspect ratio
-        if (!bPercentWidth && bWidthProvided && !bHeightProvided)
+        if (!bPercentWidth && bWidthProvided && !bHeightProvided && 
aPixelSize.Width())
             nHeight = nWidth * aPixelSize.Height() / aPixelSize.Width();
-        else if (!bPercentHeight && !bWidthProvided && bHeightProvided)
+        else if (!bPercentHeight && !bWidthProvided && bHeightProvided && 
aPixelSize.Height())
             nWidth = nHeight * aPixelSize.Width() / aPixelSize.Height();
     }
 

Reply via email to