Fix: crash by single_extruder's printable_height

jira: none
Change-Id: I2604693323236b48050560911e3a579c9918664d
This commit is contained in:
jiangkai.zhao 2025-03-20 10:16:41 +08:00 committed by lane.wei
parent d45ba14b65
commit 3215eb3639
1 changed files with 5 additions and 2 deletions

View File

@ -4494,8 +4494,11 @@ bool WipeTower::need_thick_bridge_flow(float pos_y) const {
bool WipeTower::is_valid_last_layer(int tool) const
{
int nozzle_id = m_filament_map[tool]-1;
if (tool >= 0 && tool < m_filament_map.size() && m_last_layer_id[nozzle_id]==m_cur_layer_id && m_z_pos > m_printable_height[nozzle_id]) return false;
int nozzle_id = -1;
if (tool >= 0 && tool < m_filament_map.size())
nozzle_id = m_filament_map[tool]-1;
if (nozzle_id < 0 || nozzle_id >= m_printable_height.size()) return true;
if (m_last_layer_id[nozzle_id] == m_cur_layer_id && m_z_pos > m_printable_height[nozzle_id]) return false;
return true;
}