mirror of https://github.com/kiwix/libkiwix.git
Check that 'M/Counter' exists before trying to read it.
Some old zim files may not have a 'Counter` metadata article. We have to handle this correctly.
This commit is contained in:
parent
d360b9143c
commit
7005b65901
|
@ -103,6 +103,7 @@ namespace kiwix {
|
|||
|
||||
zim::Article article = this->zimFileHandler->getArticle('M',"Counter");
|
||||
|
||||
if ( article.good() ) {
|
||||
stringstream ssContent(article.getData());
|
||||
|
||||
while(getline(ssContent, item, ';')) {
|
||||
|
@ -114,6 +115,7 @@ namespace kiwix {
|
|||
counters.insert(pair<string, int>(mimeType, counter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return counters;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue