FIX: config: fix some potential crash when load gcode.3mf

jira: STUDIO-9131
reason: sometimes the popup window causes Print::Apply using invalid configs
Change-Id: I1764050f7177a65625f4668b2e1f86c80a4d4e5a
(cherry picked from commit 5a32ce3599883b9976e32ef2c864967efd52fbc2)
(cherry picked from commit e16da5da85bc8b758e79223581c21fdd98a89a25)
This commit is contained in:
lane.wei
2024-12-10 21:52:28 +08:00
committed by Noisyfox
parent 3e27715843
commit b849426125

View File

@@ -8221,6 +8221,9 @@ void DynamicPrintConfig::update_values_to_printer_extruders(DynamicPrintConfig&
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: could not found extruder_type %2%, nozzle_volume_type %3%, extruder_index %4%")
%__LINE__ %s_keys_names_ExtruderType[extruder_type] % s_keys_names_NozzleVolumeType[nozzle_volume_type] % (e_index+1);
assert(false);
//for some updates happens in a invalid state(caused by popup window)
//we need to avoid crash
variant_index[e_index] = 0;
}
}
}
@@ -8374,6 +8377,9 @@ void DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filamen
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: could not found extruder_type %2%, nozzle_volume_type %3%, filament_index %4%, extruder index %5%")
%__LINE__ %s_keys_names_ExtruderType[extruder_type] % s_keys_names_NozzleVolumeType[nozzle_volume_type] % (f_index+1) %filament_maps[f_index];
assert(false);
//for some updates happens in a invalid state(caused by popup window)
//we need to avoid crash
variant_index[f_index] = 0;
}
}