From 8456b8381b8011796b24a5e3ead4bca505915244 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Sat, 15 Feb 2025 13:37:14 +0800 Subject: [PATCH] FIX: gui: fix a crash issue of ams sync jira: no-jira Change-Id: I1f33d20f11add12929eb6183387eaac8639698e8 (cherry picked from commit 8c4f2634c9514ceca279ab49f7ccde58e3b06a9a) --- src/slic3r/GUI/Plater.cpp | 4 ++-- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e465692491..d26871fb3f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3000,12 +3000,12 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn) for (size_t i = 0; i < merge_info.merges.size(); i++) { auto& cur = merge_info.merges[i]; - for (size_t j = cur.size() -1; j >= 1 ; j--) { + for (int j = cur.size() -1; j >= 1 ; j--) { auto last_index = cur[j]; change_filament(last_index, cur[0]); cur.erase(cur.begin() + j); sync_ams_badges.erase(sync_ams_badges.begin() + last_index); - reduce_index(merge_info, cur[j]); + reduce_index(merge_info, last_index); } } for (size_t i = 0; i < sync_ams_badges.size(); i++) { diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index fd56eea5e4..6d02d5cd13 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -293,8 +293,8 @@ void SyncAmsInfoDialog::deal_ok() m_result.sync_maps.clear(); for (size_t i = 0; i < m_ams_mapping_result.size(); i++) { auto temp_idx = m_ams_mapping_result[i].id; - if (temp_idx >= 0 && temp_idx < m_result.sync_maps.size()) { - auto &temp = m_result.sync_maps[m_ams_mapping_result[i].id]; + if (temp_idx >= 0) { + auto &temp = m_result.sync_maps[temp_idx]; temp.ams_id = m_ams_mapping_result[i].ams_id; temp.slot_id = m_ams_mapping_result[i].slot_id; }