]> git.lyx.org Git - features.git/blobdiff - src/Buffer.cpp
Fix bug #6315: counters in insets that don't produce output have ghost values.
[features.git] / src / Buffer.cpp
index b25aea441e6ba354f63fa946a5876a33cc4476f1..cf66a7def965a5c8bfd0ffdac57791ed94cff550 100644 (file)
@@ -3978,11 +3978,11 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const
        switch(layout.labeltype) {
        case LABEL_COUNTER:
                if (layout.toclevel <= bp.secnumdepth
-                   && (layout.latextype != LATEX_ENVIRONMENT
-                       || it.text()->isFirstInSequence(it.pit()))) {
-                       counters.step(layout.counter, utype);
-                       par.params().labelString(
-                               par.expandLabel(layout, bp));
+                     && (layout.latextype != LATEX_ENVIRONMENT
+                         || it.text()->isFirstInSequence(it.pit()))) {
+                       if (counters.hasCounter(layout.counter))
+                               counters.step(layout.counter, utype);
+                       par.params().labelString(par.expandLabel(layout, bp));
                } else
                        par.params().labelString(docstring());
                break;