forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user