mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-30 21:36:57 +00:00
FIX: safe the ams_id traverse
jira: [none] Change-Id: I58b7769f843f3dbef8b51a15768711257f590dba (cherry picked from commit f0efb9af0d1f5df72f2b43d8ffef581d177c49a4)
This commit is contained in:
@@ -53,6 +53,20 @@ struct FilamentInfo
|
|||||||
/*for new ams mapping*/
|
/*for new ams mapping*/
|
||||||
std::string ams_id;
|
std::string ams_id;
|
||||||
std::string slot_id;
|
std::string slot_id;
|
||||||
|
|
||||||
|
public:
|
||||||
|
int get_amd_id() const
|
||||||
|
{
|
||||||
|
if (ams_id.empty()) { return -1; };
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return stoi(ams_id);
|
||||||
|
}
|
||||||
|
catch (...) {};
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class BBLSliceInfo {
|
class BBLSliceInfo {
|
||||||
|
|||||||
@@ -1199,7 +1199,7 @@ bool MachineObject::need_SD_card() const
|
|||||||
|
|
||||||
int MachineObject::get_extruder_id_by_ams_id(const std::string &ams_id)
|
int MachineObject::get_extruder_id_by_ams_id(const std::string &ams_id)
|
||||||
{
|
{
|
||||||
if (ams_id.empty())
|
if (ams_id.empty() || (ams_id == "-1"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto it = amsList.find(ams_id);
|
auto it = amsList.find(ams_id);
|
||||||
|
|||||||
@@ -2108,7 +2108,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||||||
//check blacklist
|
//check blacklist
|
||||||
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
||||||
|
|
||||||
const auto& ams_id = m_ams_mapping_result[i].ams_id;
|
const auto& ams_id = m_ams_mapping_result[i].get_amd_id();
|
||||||
auto tid = m_ams_mapping_result[i].tray_id;
|
auto tid = m_ams_mapping_result[i].tray_id;
|
||||||
|
|
||||||
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
||||||
@@ -2124,7 +2124,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||||||
std::string action;
|
std::string action;
|
||||||
std::string info;
|
std::string info;
|
||||||
|
|
||||||
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, stoi(ams_id), in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, ams_id, in_blacklist, action, info);
|
||||||
|
|
||||||
if (in_blacklist && action == "warning") {
|
if (in_blacklist && action == "warning") {
|
||||||
wxString prohibited_error = wxString::FromUTF8(info);
|
wxString prohibited_error = wxString::FromUTF8(info);
|
||||||
@@ -2175,7 +2175,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||||||
|
|
||||||
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
||||||
|
|
||||||
const auto& ams_id = m_ams_mapping_result[i].ams_id;
|
const auto& ams_id = m_ams_mapping_result[i].get_amd_id();
|
||||||
auto tid = m_ams_mapping_result[i].tray_id;
|
auto tid = m_ams_mapping_result[i].tray_id;
|
||||||
|
|
||||||
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
||||||
@@ -2190,7 +2190,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||||||
bool in_blacklist = false;
|
bool in_blacklist = false;
|
||||||
std::string action;
|
std::string action;
|
||||||
std::string info;
|
std::string info;
|
||||||
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, stoi(ams_id), in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(filament_brand, filament_type, ams_id, in_blacklist, action, info);
|
||||||
|
|
||||||
if (in_blacklist && action == "prohibition") {
|
if (in_blacklist && action == "prohibition") {
|
||||||
has_prohibited_filament = true;
|
has_prohibited_filament = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user