aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2020-04-13 14:38:50 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2020-04-13 19:24:06 +0000
commite8cf4840b5e9445f3b4b744d4a2ac5239d562aa8 (patch)
tree83a49416500405d8abcd7a5d2309ff15553cebea
parent77541d68c135039a7ad3431ec1b2f00753e1028e (diff)
session: Fix reading values from JSON
Apparently, QJsonObject.isNull() returns false in case if key is not present in the map. This leads to wrong default values e.g. in case of the "fallback-provider-enabled" key. Fixes: QTCREATORBUG-23852 Change-Id: Idc85b3fd3a21fc4ce704c112c8c5b7a842cf57ba Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/lib/corelib/tools/jsonhelper.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/corelib/tools/jsonhelper.h b/src/lib/corelib/tools/jsonhelper.h
index d87802c0a..991d6bd6c 100644
--- a/src/lib/corelib/tools/jsonhelper.h
+++ b/src/lib/corelib/tools/jsonhelper.h
@@ -78,9 +78,9 @@ template<> inline QProcessEnvironment fromJson(const QJsonValue &v)
template<typename T> inline void setValueFromJson(T &targetValue, const QJsonObject &data,
const char *jsonProperty)
{
- const QJsonValue v = data.value(QLatin1String(jsonProperty));
- if (!v.isNull())
- targetValue = fromJson<T>(v);
+ const auto it = data.find(QLatin1String(jsonProperty));
+ if (it != data.end())
+ targetValue = fromJson<T>(*it);
}
} // namespace Internal