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

New commits:
commit e155c38e75dff41d7e80ade3c7aa9e8e69572ad4
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Oct 3 19:40:22 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Oct 10 11:34:42 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/+/140888
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit f171d9af9bb13ec037841d7c8aa11fcc628c303c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141056
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 7d2683ab3ed4..1195417a95ce 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2212,7 +2212,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