From 0229e7ed8b6617c941dd5aeb94e2ed1dac2f0772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sun, 24 Jan 2021 14:12:01 +0100 Subject: [PATCH] Don't print Warnings for whitespace-only JSON Failures (#2579) --- src/core/Cutter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index dd485909..d9a98585 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -521,6 +521,10 @@ QJsonDocument CutterCore::parseJson(const char *res, const char *cmd) QJsonDocument doc = QJsonDocument::fromJson(json, &jsonError); if (jsonError.error != QJsonParseError::NoError) { + // don't call trimmed() before knowing that parsing failed to avoid copying huge jsons all the time + if (json.trimmed().isEmpty()) { + return doc; + } if (cmd) { eprintf("Failed to parse JSON for command \"%s\": %s\n", cmd, jsonError.errorString().toLocal8Bit().constData());