FIX: gui: fix a crash issue of ams sync

jira: no-jira
Change-Id: I1f33d20f11add12929eb6183387eaac8639698e8
(cherry picked from commit 8c4f2634c9514ceca279ab49f7ccde58e3b06a9a)
This commit is contained in:
lane.wei
2025-09-17 10:39:57 +08:00
committed by Noisyfox
parent 4ce8403888
commit 8456b8381b
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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++) { for (size_t i = 0; i < merge_info.merges.size(); i++) {
auto& cur = merge_info.merges[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]; auto last_index = cur[j];
change_filament(last_index, cur[0]); change_filament(last_index, cur[0]);
cur.erase(cur.begin() + j); cur.erase(cur.begin() + j);
sync_ams_badges.erase(sync_ams_badges.begin() + last_index); 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++) { for (size_t i = 0; i < sync_ams_badges.size(); i++) {
+2 -2
View File
@@ -293,8 +293,8 @@ void SyncAmsInfoDialog::deal_ok()
m_result.sync_maps.clear(); m_result.sync_maps.clear();
for (size_t i = 0; i < m_ams_mapping_result.size(); i++) { for (size_t i = 0; i < m_ams_mapping_result.size(); i++) {
auto temp_idx = m_ams_mapping_result[i].id; auto temp_idx = m_ams_mapping_result[i].id;
if (temp_idx >= 0 && temp_idx < m_result.sync_maps.size()) { if (temp_idx >= 0) {
auto &temp = m_result.sync_maps[m_ams_mapping_result[i].id]; auto &temp = m_result.sync_maps[temp_idx];
temp.ams_id = m_ams_mapping_result[i].ams_id; temp.ams_id = m_ams_mapping_result[i].ams_id;
temp.slot_id = m_ams_mapping_result[i].slot_id; temp.slot_id = m_ams_mapping_result[i].slot_id;
} }