]> git.lyx.org Git - features.git/commitdiff
Do not try to access user_defined_bullet with nesting > 3
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 6 Mar 2022 16:27:28 +0000 (17:27 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 6 Mar 2022 16:27:28 +0000 (17:27 +0100)
We only have 4 nesting labels available.

In the workarea, display a fallback label with deeper nesting.

src/Buffer.cpp
src/RowPainter.cpp

index 54272a79d51faf8ce38e4ef10eb77b64f8794a45..5295a4bfc577191af725361c350d23521f2f963e 100644 (file)
@@ -5158,7 +5158,10 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const
        switch(layout.labeltype) {
        case LABEL_ITEMIZE: {
                par.params().labelString(
-                       bp.user_defined_bullet(par.itemdepth).getLabel());
+                       (par.itemdepth < 4)
+                                       ? bp.user_defined_bullet(par.itemdepth).getLabel()
+                                         // Display fallback for too deeply nested items
+                                       : bformat(from_ascii("[?%1$d]"), int(par.itemdepth + 1)));
                break;
        }
 
index 84848ec05a25521fa9634613e2cbd85839b90e43..4f5593e18b3764bce121ea2dae5255888fedc052 100644 (file)
@@ -434,7 +434,7 @@ void RowPainter::paintLabel() const
        FontInfo lfont = font;
 
        // bullet?
-       if (layout.labeltype == LABEL_ITEMIZE) {
+       if (layout.labeltype == LABEL_ITEMIZE && par_.itemdepth < 4) {
                // get label font size from document properties
                lfont.setSize(pi_.base.bv->buffer().params().user_defined_bullet(par_.itemdepth).getFontSize());
                // realize to avoid assertion