mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 09:02:06 +00:00
FIX: The value maybe string or int
JIRA: [STUDIO-13018] Change-Id: I4af161431fb51e1e0234bc37de8346b45f3ca4b7 (cherry picked from commit 4e2934685033c352ea2c3baded585381c285a90d)
This commit is contained in:
@@ -2989,7 +2989,18 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
}
|
||||
}
|
||||
if (j_pre["print"].contains("plate_idx")){ // && m_plate_index == -1
|
||||
m_plate_index = j_pre["print"]["plate_idx"].get<int>();
|
||||
if (j_pre["print"]["plate_idx"].is_number())
|
||||
{
|
||||
m_plate_index = j_pre["print"]["plate_idx"].get<int>();
|
||||
}
|
||||
else if (j_pre["print"]["plate_idx"].is_string())
|
||||
{
|
||||
try
|
||||
{
|
||||
m_plate_index = std::stoi(j_pre["print"]["plate_idx"].get<std::string>());
|
||||
}
|
||||
catch (...) { BOOST_LOG_TRIVIAL(error) << "parse_json: failed to convert plate_idx to int"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j_pre.contains("system")) {
|
||||
|
||||
Reference in New Issue
Block a user