Do not crash if zim file has no `Counter` metadata.

This commit is contained in:
Matthieu Gautier 2021-01-26 15:15:27 +01:00
parent e0bcafd89a
commit 4749656828
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 */