From fdf968debbca676f1c8e17668cac4ad90c3d5277 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 30 Nov 2015 16:59:34 +0100 Subject: [PATCH] Debugger: Handle JSON null values when translating to python Change-Id: I47aaeb564107642543ba8038fc175a2c2203bebc Reviewed-by: Edward Welbourne Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggerprotocol.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index 4a1a7574b4c..9bbde8a4670 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -855,8 +855,14 @@ void DebuggerCommand::arg(const char *name, const QJsonValue &value) static QJsonValue translateJsonToPython(const QJsonValue &value) { - // TODO: Verify that this covers all incompatibilities between python and json. + // TODO: Verify that this covers all incompatibilities between python and json, + // e.g. number format and precision + switch (value.type()) { + // Undefined is not a problem as the JSON generator ignores that. + case QJsonValue::Null: + // Python doesn't understand "null" + return QJsonValue(0); case QJsonValue::Bool: // Python doesn't understand lowercase "true" or "false" return QJsonValue(value.toBool() ? 1 : 0);