mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-06 13:26:58 +03:00
Add Json::parseUntilMalformed helper
Signed-off-by: Dylan Schooner <dschooner05@gmail.com>
(cherry picked from commit e1eee6e3ca)
This commit is contained in:
parent
1ebe081e03
commit
811e3de29b
3 changed files with 16 additions and 8 deletions
|
|
@ -169,15 +169,9 @@ bool processZIP(DataPack* pack, ProcessingLevel level)
|
|||
bool processMCMeta(DataPack* pack, QByteArray&& raw_data)
|
||||
{
|
||||
QJsonParseError parse_error;
|
||||
auto json_doc = QJsonDocument::fromJson(raw_data, &parse_error);
|
||||
auto json_doc = Json::parseUntilMalformed(raw_data, &parse_error);
|
||||
if (parse_error.error != QJsonParseError::NoError) {
|
||||
QByteArray validJson = raw_data.left(parse_error.offset);
|
||||
json_doc = QJsonDocument::fromJson(validJson, &parse_error);
|
||||
|
||||
if (parse_error.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Failed to parse JSON:" << parse_error.errorString();
|
||||
return false;
|
||||
}
|
||||
qWarning() << "Failed to parse JSON:" << parse_error.errorString();
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue