mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
Merge pull request #1096 from kiwix/Library_getArchive_doesnt_return_null
This commit is contained in:
commit
49858fffc6
@ -60,7 +60,11 @@ QString Library::openBookFromPath(const QString &zimPath)
|
|||||||
|
|
||||||
std::shared_ptr<zim::Archive> Library::getArchive(const QString &zimId)
|
std::shared_ptr<zim::Archive> 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<zim::Searcher> Library::getSearcher(const QString &zimId)
|
std::shared_ptr<zim::Searcher> Library::getSearcher(const QString &zimId)
|
||||||
|
@ -39,9 +39,6 @@ void ReadingListBar::setupList()
|
|||||||
} catch (std::out_of_range& e) {
|
} catch (std::out_of_range& e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( !archive ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
auto illustration = archive->getIllustrationItem(48);
|
auto illustration = archive->getIllustrationItem(48);
|
||||||
std::string content = illustration.getData();
|
std::string content = illustration.getData();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user