Debugger: Handle JSON null values when translating to python

Change-Id: I47aaeb564107642543ba8038fc175a2c2203bebc
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-11-30 16:59:34 +01:00
parent 4bdba9c131
commit fdf968debb

View File

@@ -855,8 +855,14 @@ void DebuggerCommand::arg(const char *name, const QJsonValue &value)
static QJsonValue translateJsonToPython(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()) { 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: case QJsonValue::Bool:
// Python doesn't understand lowercase "true" or "false" // Python doesn't understand lowercase "true" or "false"
return QJsonValue(value.toBool() ? 1 : 0); return QJsonValue(value.toBool() ? 1 : 0);