From 82ee622ce30502a53db99e6e7ada6dceb39e4a87 Mon Sep 17 00:00:00 2001 From: Stone Li Date: Thu, 30 Mar 2023 15:08:50 +0800 Subject: [PATCH] ENH: avoid to crash log when parsing sequence_id Change-Id: I14ff7167cf4291a09d955d1ac295197470734546 --- src/slic3r/GUI/DeviceManager.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 82cc286f5..f890dc2be 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -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(); - try { - sequence_id = stoi(str_seq); - } - catch(...) { - ; + if (jj["sequence_id"].is_string()) { + std::string str_seq = jj["sequence_id"].get(); + try { + sequence_id = stoi(str_seq); + } + catch(...) { + ; + } } } if (jj.contains("command")) {