Showing the changes to libraries/script-engine/src/ScriptMessage.cpp (1 of 3 files). Show all
Unified · Split
| @@ -25,6 +25,10 @@ QJsonObject ScriptMessage::toJson() { · 24 unmodified lines | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | bool ScriptMessage::fromJson(const QJsonObject &object) { | 27 | bool ScriptMessage::fromJson(const QJsonObject &object) { |
| 28 | if (object.isEmpty()) { | ||
| 29 | qDebug() << "ScriptMessage::fromJson object is empty"; | ||
| 30 | return false; | ||
| 31 | } | ||
| 28 | if (!object["message"].isString() | 32 | if (!object["message"].isString() |
| 29 | || !object["lineNumber"].isDouble() | 33 | || !object["lineNumber"].isDouble() |
| 30 | || !object["fileName"].isString() | 34 | || !object["fileName"].isString() |
| @@ -40,4 +44,5 @@ bool ScriptMessage::fromJson(const QJsonObject &object) { · 9 unmodified lines | |||
| 40 | _entityID = QUuid::fromString(object["entityID"].toString()); | 44 | _entityID = QUuid::fromString(object["entityID"].toString()); |
| 41 | _scriptType = static_cast<ScriptMessage::ScriptType>(object["type"].toInt()); | 45 | _scriptType = static_cast<ScriptMessage::ScriptType>(object["type"].toInt()); |
| 42 | _severity = static_cast<ScriptMessage::Severity>(object["severity"].toInt()); | 46 | _severity = static_cast<ScriptMessage::Severity>(object["severity"].toInt()); |
| 47 | return true; | ||
| 43 | } | 48 | } |