editeng/source/items/numitem.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit a4485bd8e03ad4487fe47a4480a9aacfbaf61980
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Thu Nov 11 10:33:08 2021 +0300
Commit:     Vasily Melenchuk <vasily.melenc...@cib.de>
CommitDate: Sat Nov 13 09:58:46 2021 +0100

    tdf#145610: lists should not have includeUpperLevels < 1
    
    Unlike its name, this variable stores *total* amount of levels
    to includes, so during conversion even empty list format to
    prefix/suffix/includeupperlevels we should keep last one above
    zero so list even in future will not have issues with levels
    to display.
    
    Change-Id: I4992c1ac0194f381df9f7b965ecdb2d688892b30
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125022
    Tested-by: Jenkins
    Reviewed-by: Vasily Melenchuk <vasily.melenc...@cib.de>

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index ca454d92f894..b862b866c50f 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -640,6 +640,13 @@ void 
SvxNumberFormat::SetListFormat(std::optional<OUString> oSet)
             nPercents++;
     }
     nInclUpperLevels = nPercents/2;
+    if (nInclUpperLevels < 1)
+    {
+        // There should be always at least one level. This will be not required
+        // in future (when we get rid of prefix/suffix), but nowadays there
+        // are too many conversions "list format" <-> 
"prefix/suffix/inclUpperLevel"
+        nInclUpperLevels = 1;
+    }
 }
 
 OUString SvxNumberFormat::GetListFormat(bool bIncludePrefixSuffix /*= true*/) 
const

Reply via email to