diff --git a/src/library.cpp b/src/library.cpp index fa26552..656a4ec 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -60,7 +60,11 @@ QString Library::openBookFromPath(const QString &zimPath) std::shared_ptr Library::getArchive(const QString &zimId) { - return mp_library->getArchiveById(zimId.toStdString()); + const auto archive = mp_library->getArchiveById(zimId.toStdString()); + if ( ! archive ) { + throw std::out_of_range("ZIM file doesn't exist (or cannot be opened)"); + } + return archive; } std::shared_ptr Library::getSearcher(const QString &zimId)