From 1c2628b5de383724daa8a203ad3878044a5eb304 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 6 Mar 2022 17:27:28 +0100 Subject: [PATCH] Do not try to access user_defined_bullet with nesting > 3 We only have 4 nesting labels available. In the workarea, display a fallback label with deeper nesting. --- src/Buffer.cpp | 5 ++++- src/RowPainter.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 54272a79d5..5295a4bfc5 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -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; } diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp index 84848ec05a..4f5593e18b 100644 --- a/src/RowPainter.cpp +++ b/src/RowPainter.cpp @@ -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 -- 2.39.5