diff options
Diffstat (limited to 'logic/minecraft/ProfileUtils.cpp')
-rw-r--r-- | logic/minecraft/ProfileUtils.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/logic/minecraft/ProfileUtils.cpp b/logic/minecraft/ProfileUtils.cpp index 9a886f1d..5816f207 100644 --- a/logic/minecraft/ProfileUtils.cpp +++ b/logic/minecraft/ProfileUtils.cpp @@ -107,13 +107,26 @@ VersionFilePtr parseJsonFile(const QFileInfo &fileInfo, const bool requireOrder) .arg(fileInfo.fileName(), file.errorString())); } QJsonParseError error; - QJsonDocument doc = QJsonDocument::fromJson(file.readAll(), &error); + auto data = file.readAll(); + QJsonDocument doc = QJsonDocument::fromJson(data, &error); if (error.error != QJsonParseError::NoError) { + int line = 0; + int column = 0; + for(int i = 0; i < error.offset; i++) + { + if(data[i] == '\n') + { + line++; + column = 0; + continue; + } + column++; + } throw JSONValidationError( - QObject::tr("Unable to process the version file %1: %2 at %3.") + QObject::tr("Unable to process the version file %1: %2 at line %3 column %4.") .arg(fileInfo.fileName(), error.errorString()) - .arg(error.offset)); + .arg(line).arg(column)); } return VersionFile::fromJson(doc, file.fileName(), requireOrder); } |