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,12 +2384,14 @@ int MachineObject::parse_json(std::string payload)
|
|||
json jj = j["print"];
|
||||
int sequence_id = 0;
|
||||
if (jj.contains("sequence_id")) {
|
||||
std::string str_seq = jj["sequence_id"].get<std::string>();
|
||||
try {
|
||||
sequence_id = stoi(str_seq);
|
||||
}
|
||||
catch(...) {
|
||||
;
|
||||
if (jj["sequence_id"].is_string()) {
|
||||
std::string str_seq = jj["sequence_id"].get<std::string>();
|
||||
try {
|
||||
sequence_id = stoi(str_seq);
|
||||
}
|
||||
catch(...) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jj.contains("command")) {
|
||||
|
|
Loading…
Reference in a new issue