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
{
auto counterContent = zimArchive->getMetadata("Counter");
return parseMimetypeCounter(counterContent);
try {
auto counterContent = zimArchive->getMetadata("Counter");
return parseMimetypeCounter(counterContent);
} catch (zim::EntryNotFound& e) {
return {};
}
}
/* Get the count of articles which can be indexed/displayed */