commit d8a0f1aadda25e11e5a330e8c7cdd0d413ff55b4
Author: Thibaut Cuvelier <tcuvel...@lyx.org>
Date:   Sun Oct 8 21:11:17 2023 +0200

    DocBook: fix a crash in docbookSimpleAllParagraphs.
    
    When having the code preview pane open with 
examples/Language_Support/Mixing_Japanese_with_other_Languages_(with_CJKutf8), 
clicking at random on paragraphs sometimes yielded a crash: *par when par is 
the end of the iterator. LyX could output the whole document as DocBook without 
this patch and still generates the same output with it (i.e. no text is 
missing).
---
 src/output_docbook.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 19f6de4..983d4e7 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -1127,8 +1127,9 @@ void docbookSimpleAllParagraphs(
 
        // Then, the content. It starts where the <info> ends.
        auto par = paragraphs.iterator_at(info.epit);
-       auto end = paragraphs.iterator_at(epit);
-       while (par != end) {
+       auto par_epit = paragraphs.iterator_at(epit);
+       auto par_end = paragraphs.end();
+       while (par != par_epit && par != par_end) {
                if (!hasOnlyNotes(*par))
                        par = makeAny(text, buf, xs, runparams, par);
                else
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to