X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftext2.C;h=d27f5e1dbdb4fcdfe5b8580174c4e20014816fdd;hb=80328d2053869dc089c23c25adbed4167d7bf0b1;hp=a447565c380c160b6ff9a8c0203fb3be38f8bb3e;hpb=f4cc84d5a611fb99063540a57ac6f8c9353651a2;p=lyx.git diff --git a/src/text2.C b/src/text2.C index a447565c38..d27f5e1dbd 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1246,6 +1246,8 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, void LyXText::deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool trackChanges) { + BOOST_ASSERT(first >= 0 && first <= last && last < (int) pars_.size()); + for (pit_type pit = first; pit <= last; ++pit) { Paragraph & par = pars_[pit]; @@ -1262,8 +1264,9 @@ void LyXText::deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool } } - // don't delete anything if this is the ONLY paragraph - if (pars_.size() == 1) + // don't delete anything if this is the only remaining paragraph within the given range + // note: LyXText::acceptOrRejectChanges() sets the cursor to 'first' after calling DEPM + if (first == last) continue; // don't delete empty paragraphs with keepempty set