修复访问野指针的问题:#146

This commit is contained in:
xiongziliang 2019-11-21 13:46:42 +08:00
parent e6d511cc9e
commit 083933cbad

View File

@ -433,8 +433,9 @@ static string findIndexFile(const string &dir){
while ((pDirent = readdir(pDir)) != NULL) {
static set<const char *,StrCaseCompare> indexSet = {"index.html","index.htm","index"};
if(indexSet.find(pDirent->d_name) != indexSet.end()){
string ret = pDirent->d_name;
closedir(pDir);
return pDirent->d_name;
return ret;
}
}
closedir(pDir);