Fix "Access Violation" (#12704) (#12856)

Co-authored-by: Kiss Lorand <50251547+kisslorand@users.noreply.github.com>
This commit is contained in:
Rodrigo Faselli
2026-04-05 15:10:09 -03:00
committed by GitHub
parent aa51d1965f
commit cfc2e9b62a

View File

@@ -5354,8 +5354,10 @@ void GCodeProcessor::process_M1020(const GCodeReader::GCodeLine &line)
BOOST_LOG_TRIVIAL(error) << "Invalid M1020 command (" << line.raw() << ").";
}
else {
if (eid >= m_result.filaments_count)
if (eid >= m_result.filaments_count) {
BOOST_LOG_TRIVIAL(error) << "Invalid M1020 command (" << line.raw() << ").";
return;
}
process_filament_change(eid);
}
}
@@ -5383,8 +5385,10 @@ void GCodeProcessor::process_T(const std::string_view command)
BOOST_LOG_TRIVIAL(error) << "Invalid T command (" << command << ").";
}
else {
if (eid >= m_result.filaments_count)
if (eid >= m_result.filaments_count) {
BOOST_LOG_TRIVIAL(error) << "Invalid T command (" << command << ").";
return;
}
process_filament_change(eid);
}
}