cui/source/tabpages/numpages.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1896d200ecc775aa3a66cc772adc635332562f21
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Oct 3 19:40:22 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Oct 3 21:14:38 2022 +0200

    cui: avoid divide by zero in SvxNumberingPreview::Paint
    
    Just check for pActNum->GetLevelCount() > 1 as done later for nYStep
    
    See 
https://crashreport.libreoffice.org/stats/signature/SvxNumberingPreview::Paint(OutputDevice%20&,tools::Rectangle%20const%20&)
    
    Change-Id: I0e9518dafe50b2b10a83487e9247e2fd46f9decd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140921
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 050e8c7c0ec8..57648fa612db 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2202,7 +2202,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& 
rRenderContext, const ::tool
         tools::Long nWidthRelation = 30; // chapter dialog
 
         // height per level
-        tools::Long nXStep = aSize.Width() / (3 * pActNum->GetLevelCount());
+        tools::Long nXStep = aSize.Width() / (pActNum->GetLevelCount() > 1 ? 3 
* pActNum->GetLevelCount() : 3);
         if (pActNum->GetLevelCount() < 10)
             nXStep /= 2;
         tools::Long nYStart = 4;

Reply via email to