Merge pull request #449 from kiwix/handle_no_counter

Do not crash if zim file has no `Counter` metadata.
This commit is contained in:
Matthieu Gautier 2021-01-26 17:52:33 +01:00 committed by GitHub
commit f5d9a3714d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -93,8 +93,12 @@ zim::Archive* Reader::getZimArchive() const
MimeCounterType Reader::parseCounterMetadata() const MimeCounterType Reader::parseCounterMetadata() const
{ {
try {
auto counterContent = zimArchive->getMetadata("Counter"); auto counterContent = zimArchive->getMetadata("Counter");
return parseMimetypeCounter(counterContent); return parseMimetypeCounter(counterContent);
} catch (zim::EntryNotFound& e) {
return {};
}
} }
/* Get the count of articles which can be indexed/displayed */ /* Get the count of articles which can be indexed/displayed */