mirror of https://github.com/kiwix/libkiwix.git
+ few additional check to avoid segfaults if ZIM file is not there
This commit is contained in:
parent
97881fbbb6
commit
4b6caa48ce
|
@ -206,6 +206,11 @@ namespace kiwix {
|
||||||
/* Get a content from a zim file */
|
/* Get a content from a zim file */
|
||||||
bool Reader::getContentByUrl(const string &urlStr, string &content, unsigned int &contentLength, string &contentType) {
|
bool Reader::getContentByUrl(const string &urlStr, string &content, unsigned int &contentLength, string &contentType) {
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
|
content="";
|
||||||
|
contentType="";
|
||||||
|
contentLength = 0;
|
||||||
|
|
||||||
|
if (this->zimFileHandler != NULL) {
|
||||||
const char *url = urlStr.c_str();
|
const char *url = urlStr.c_str();
|
||||||
|
|
||||||
/* Offset to visit the url */
|
/* Offset to visit the url */
|
||||||
|
@ -282,12 +287,7 @@ namespace kiwix {
|
||||||
|
|
||||||
/* Set return value */
|
/* Set return value */
|
||||||
retVal = true;
|
retVal = true;
|
||||||
} else {
|
}
|
||||||
/* The found article is not the good one */
|
|
||||||
content="";
|
|
||||||
contentType="";
|
|
||||||
contentLength = 0;
|
|
||||||
retVal = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
Loading…
Reference in New Issue