+ few additional check to avoid segfaults if ZIM file is not there

This commit is contained in:
kelson42 2011-07-27 19:25:25 +00:00
parent 97881fbbb6
commit 4b6caa48ce
1 changed files with 79 additions and 79 deletions

View File

@ -206,6 +206,11 @@ namespace kiwix {
/* Get a content from a zim file */
bool Reader::getContentByUrl(const string &urlStr, string &content, unsigned int &contentLength, string &contentType) {
bool retVal = false;
content="";
contentType="";
contentLength = 0;
if (this->zimFileHandler != NULL) {
const char *url = urlStr.c_str();
/* Offset to visit the url */
@ -282,12 +287,7 @@ namespace kiwix {
/* Set return value */
retVal = true;
} else {
/* The found article is not the good one */
content="";
contentType="";
contentLength = 0;
retVal = false;
}
}
return retVal;