From 6c516699d7622c9aac91ef5a309b815a5005817b Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 30 Jan 2024 10:13:21 -0500 Subject: Fixed infinite loop at end of bible (Rev 22) --- src/lib/libbible.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/lib/libbible.cc') diff --git a/src/lib/libbible.cc b/src/lib/libbible.cc index c6850f7..f3b9820 100644 --- a/src/lib/libbible.cc +++ b/src/lib/libbible.cc @@ -184,11 +184,11 @@ vector libbible::getText(libbible::passage pass) { string book = string(key->getBookName()); - for(; string(key->getBookName()) == book && + /*for(; string(key->getBookName()) == book && (key->getChapter() < pass.chapterEnd || (key->getChapter() == pass.chapterEnd && key->getVerse() <= pass.verseEnd)); - (*key)++) { - + (*key)++) {*/ + while(true) { string text = string(target->renderText()); //printf("Working with: %s\n", text.c_str()); @@ -276,6 +276,11 @@ vector libbible::getText(libbible::passage pass) { } } endOfParagraph = ! text.empty() and text.back() == '\n'; + if(string(key->getBookName()) != book || + (key->getChapter() >= pass.chapterEnd && key->getVerse() >= pass.verseEnd)) { + break; + } + (*key)++; } return texts; } -- cgit v1.2.3