summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-17 09:43:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-11-17 14:40:26 +0100
commit6a5c8d9609d2d3b1dc4b7f67ea41fb43add9a993 (patch)
treeb6ffe0d0589976f281ad4b97007220baf3201f84
parentb4f03a95db84c1d18c9435d13f41787596d34b12 (diff)
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 <caolanm@redhat.com>
-rw-r--r--sw/source/filter/html/htmlgrin.cxx4
1 files changed, 2 insertions, 2 deletions
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();
}