ENH: fix unable to load video

1. also  add protect for filament map read

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I321be9f49d7696d02ed7771852713c0cef5d5ebd
(cherry picked from commit 8b735631b1b068b87c46c32243d183e9aec41b60)
This commit is contained in:
xun.zhang 2025-02-15 11:19:06 +08:00 committed by Noisyfox
parent ce8ca8f05e
commit efdcf91d96

View file

@ -4237,8 +4237,15 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
}
}
else if (key == FILAMENT_MAP_ATTR) {
if (m_curr_plater)
m_curr_plater->config.set_key_value("filament_map", new ConfigOptionInts(get_vector_from_string(value)));
if (m_curr_plater){
auto filament_map = get_vector_from_string(value);
for (size_t idx = 0; idx < filament_map.size(); ++idx) {
if (filament_map[idx] < 1) {
filament_map[idx] = 1;
}
}
m_curr_plater->config.set_key_value("filament_map", new ConfigOptionInts(filament_map));
}
}
else if (key == UNPRINTABLE_FILAMENT_MAP_ATTR)
{