ENH: avoid to crash log when parsing sequence_id
Change-Id: I14ff7167cf4291a09d955d1ac295197470734546
This commit is contained in:
parent
9606a04117
commit
82ee622ce3
1 changed files with 8 additions and 6 deletions
|
@ -2384,6 +2384,7 @@ int MachineObject::parse_json(std::string payload)
|
||||||
json jj = j["print"];
|
json jj = j["print"];
|
||||||
int sequence_id = 0;
|
int sequence_id = 0;
|
||||||
if (jj.contains("sequence_id")) {
|
if (jj.contains("sequence_id")) {
|
||||||
|
if (jj["sequence_id"].is_string()) {
|
||||||
std::string str_seq = jj["sequence_id"].get<std::string>();
|
std::string str_seq = jj["sequence_id"].get<std::string>();
|
||||||
try {
|
try {
|
||||||
sequence_id = stoi(str_seq);
|
sequence_id = stoi(str_seq);
|
||||||
|
@ -2392,6 +2393,7 @@ int MachineObject::parse_json(std::string payload)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (jj.contains("command")) {
|
if (jj.contains("command")) {
|
||||||
if (jj["command"].get<std::string>() == "push_status") {
|
if (jj["command"].get<std::string>() == "push_status") {
|
||||||
m_push_count++;
|
m_push_count++;
|
||||||
|
|
Loading…
Reference in a new issue