FIX:Fix the issue of importing GCode array out of bounds

jira: STUDIO-12389
Change-Id: Id7995558bf0e297e2360b338ffbf63d93efa38f0
(cherry picked from commit 6d15a9005769a7dbfb96bb28ce6b57e55bf1c435)
This commit is contained in:
zhou.xu
2025-05-26 21:01:24 +08:00
committed by Noisyfox
parent 38ad17ffbe
commit adeb3ab3f7
3 changed files with 13 additions and 2 deletions

View File

@@ -5436,6 +5436,16 @@ void GCodeProcessor::process_T(const std::string_view command)
}
void GCodeProcessor::init_filament_maps_and_nozzle_type_when_import_only_gcode()
{
if (m_filament_maps.empty()) {
m_filament_maps.assign((int) EnforcerBlockerType::ExtruderMax, 1);
}
if (m_result.nozzle_type.empty()) {
m_result.nozzle_type.assign((int) EnforcerBlockerType::ExtruderMax, NozzleType::ntUndefine);
}
}
void GCodeProcessor::process_filament_change(int id)
{
assert(id < m_result.filaments_count);
@@ -5811,7 +5821,7 @@ void GCodeProcessor::update_slice_warnings()
warning.params.clear();
warning.level=1;
std::vector<int>nozzle_hrc_lists(m_result.nozzle_type.size(), 0);
std::vector<int> nozzle_hrc_lists(m_result.nozzle_type.size(), 0);
// store the nozzle hrc of each extruder
for (size_t idx = 0; idx < m_result.nozzle_type.size(); ++idx) {
nozzle_hrc_lists[idx] = m_result.nozzle_hrc;