diff options
Diffstat (limited to 'libbible.cc')
-rw-r--r-- | libbible.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libbible.cc b/libbible.cc index 7b08174..29e8873 100644 --- a/libbible.cc +++ b/libbible.cc @@ -42,6 +42,10 @@ map<string, vector<string>> libbible::getModules() { vector<libbible::passage> libbible::getPassages(string modName, string book) { vector<libbible::passage> passages; SWModule *target = library.getModule(modName.c_str()); + if(target == nullptr) { + // Module doesn't exist + return passages; + } target->setKey((book + " " + "1").c_str()); VerseKey *key = (VerseKey *) target->getKey(); int maxChapter = key->getChapterMax(); @@ -124,13 +128,17 @@ void inferMissing(libbible::passage *pass, SWModule *target) { } vector<libbible::text> libbible::getText(libbible::passage pass) { + vector<libbible::text> texts; SWModule *target = library.getModule(pass.modName.c_str()); + if(target == nullptr) { + // Module doesn't exist + return texts; + } inferMissing(&pass, target); target->setKey((pass.book + " " + to_string(pass.chapterStart) + ":" + to_string(pass.verseStart)).c_str()); VerseKey *key = (VerseKey *) target->getKey(); - vector<libbible::text> texts; bool endOfParagraph = false; |