svtools/source/control/ctrlbox.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit aef5eb654ce5cd6b0026d50782137e79664dc30a
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Jun 21 16:58:24 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Jun 24 23:21:36 2022 +0200

    svtools: avoid divide by zero in calcCustomItemSize
    
    See 
https://crashreport.libreoffice.org/stats/signature/%60anonymous%20namespace'::calcCustomItemSize
    
    Change-Id: I5f1b19b7679c73cf29952629469e5151395b2b12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136254
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit ec03eef9b431048ea21a733c39c79b792b0f653c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136393

diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 411a2dd4961d..37952f5336e2 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -343,7 +343,8 @@ namespace
         gUserItemSz.setHeight(gUserItemSz.Height() / 10);
 
         size_t nMaxDeviceHeight = SAL_MAX_INT16 / 16; // see 
limitXCreatePixmap and be generous wrt up to x16 hidpi
-        gPreviewsPerDevice = nMaxDeviceHeight / gUserItemSz.Height();
+        assert(gUserItemSz.Height() != 0);
+        gPreviewsPerDevice = gUserItemSz.Height() == 0 ? 16 : nMaxDeviceHeight 
/ gUserItemSz.Height();
     }
 }
 

Reply via email to