commit 967fe90d0e527d3909793ef98126d97582991c60
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed Jan 7 14:31:13 2026 +0100

    Revert "counter stack might be legally empty"
    
    This reverts commit 820d9d84e6540efd3aff8610f19722677f0d5de3.
---
 src/Buffer.cpp   | 3 +--
 src/Counters.cpp | 8 +++-----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index e042e5713e..88ba8d0c9e 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -5339,8 +5339,7 @@ void Buffer::Impl::setLabel(ParIterator & it, ParIterator 
& prev_it,
        }
 
        // restore previous counter after environmental counter
-       if (!counters.currentCounter().empty()
-           && prev_it != it && prev_par.params().depth() >= 
par.params().depth()
+       if (prev_it != it && prev_par.params().depth() >= par.params().depth()
            && prev_par.layout().isEnvironment() 
            && (prev_par.layout().labeltype == LABEL_ENUMERATE
                || !prev_par.layout().counter.empty())
diff --git a/src/Counters.cpp b/src/Counters.cpp
index d211046823..a93274558a 100644
--- a/src/Counters.cpp
+++ b/src/Counters.cpp
@@ -400,8 +400,8 @@ void Counters::step(docstring const & ctr, UpdateType /* 
deleted */, bool const
                step(it->second.stepOtherCounter(), InternalUpdate, false);
 
        if (set_active) {
-               if (!counter_stack_.empty())
-                       counter_stack_.pop_back();
+               LBUFERR(!counter_stack_.empty());
+               counter_stack_.pop_back();
                counter_stack_.push_back(ctr);
        }
 
@@ -703,9 +703,7 @@ docstring Counters::prettyCounter(docstring const & name,
 
 docstring Counters::currentCounter() const
 {
-       if (counter_stack_.empty())
-               return docstring();
-
+       LBUFERR(!counter_stack_.empty());
        return counter_stack_.back();
 }
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to