Fix #354, make jar mods and patch files in general more resilient.

This commit is contained in:
Petr Mrázek
2014-07-10 01:26:45 +02:00
parent ff06489fed
commit 40c238442f
2 changed files with 12 additions and 3 deletions

View File

@ -111,8 +111,14 @@ void VersionBuilder::readInstancePatches()
continue;
// parse the file
QString filename = patches.absoluteFilePath(id + ".json");
QFileInfo finfo(filename);
if(!finfo.exists())
{
QLOG_INFO() << "Patch file " << filename << " was deleted by external means...";
continue;
}
QLOG_INFO() << "Reading" << filename << "by user order";
auto file = parseJsonFile(QFileInfo(filename), false);
auto file = parseJsonFile(finfo, false);
// sanity check. prevent tampering with files.
if (file->fileId != id)
{