From 44d1756783262ae0af39991e18ec9bcb847fb439 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 5 Mar 2022 14:17:37 +0100 Subject: [PATCH] Don't asssert on (too) deeply nested items Use a fallback label instead. --- src/BufferParams.cpp | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 95aa9136d2..b1846beaa3 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -633,29 +633,45 @@ bool BufferParams::spellignored(WordLangTuple const & wl) const Bullet & BufferParams::temp_bullet(lyx::size_type const index) { - LASSERT(index < 4, return pimpl_->temp_bullets[0]); - return pimpl_->temp_bullets[index]; + if (index < 4) + return pimpl_->temp_bullets[index]; + // Fallback bullet if we are too deeply nested + docstring const fb = from_ascii("?") + convert(index + 1); + Bullet const & res = Bullet(fb); + return const_cast(res); } Bullet const & BufferParams::temp_bullet(lyx::size_type const index) const { - LASSERT(index < 4, return pimpl_->temp_bullets[0]); - return pimpl_->temp_bullets[index]; + if (index < 4) + return pimpl_->temp_bullets[index]; + // Fallback bullet if we are too deeply nested + docstring const fb = from_ascii("?") + convert(index + 1); + Bullet const & res = Bullet(fb); + return res; } Bullet & BufferParams::user_defined_bullet(lyx::size_type const index) { - LASSERT(index < 4, return pimpl_->temp_bullets[0]); - return pimpl_->user_defined_bullets[index]; + if (index < 4) + return pimpl_->user_defined_bullets[index]; + // Fallback bullet if we are too deeply nested + docstring const fb = from_ascii("?") + convert(index + 1); + Bullet const & res = Bullet(fb); + return const_cast(res); } Bullet const & BufferParams::user_defined_bullet(lyx::size_type const index) const { - LASSERT(index < 4, return pimpl_->temp_bullets[0]); - return pimpl_->user_defined_bullets[index]; + if (index < 4) + return pimpl_->user_defined_bullets[index]; + // Fallback bullet if we are too deeply nested + docstring const fb = from_ascii("?") + convert(index + 1); + Bullet const & res = Bullet(fb); + return res; } -- 2.39.5