Skip extras without filename

This commit is contained in:
Sude 2015-05-31 19:07:21 +03:00
parent 0230a3517d
commit 584b953bd7

View File

@ -2250,9 +2250,13 @@ std::vector<gameFile> Downloader::getExtrasFromJSON(const Json::Value& json, con
path = "/" + gamename + "/extras/" + path;
}
// Get name from path if name was not specified
// Get filename
std::string filename;
filename.assign(path.begin()+path.find_last_of("/")+1,path.end());
// Use filename if name was not specified
if (name.empty())
name.assign(path.begin()+path.find_last_of("/")+1,path.end());
name = filename;
if (name.empty())
{
@ -2263,6 +2267,15 @@ std::vector<gameFile> Downloader::getExtrasFromJSON(const Json::Value& json, con
continue;
}
if (filename.empty())
{
#ifdef DEBUG
std::cerr << "DEBUG INFO (getExtrasFromJSON)" << std::endl;
std::cerr << "Skipped file without a filename (game: " << gamename << ", fileid: " << id << ", name: " << name << ")" << std::endl;
#endif
continue;
}
extras.push_back(
gameFile ( false,
id,