Fix crash when syncing filaments after a plate is deleted (#17042)

The sync dialog is reused between syncs, and its plate index is left over from the last one. If that plate no longer exists, because it was deleted or a project with fewer plates was loaded, the next sync read the thumbnail of a null plate and crashed. reinit_dialog() now falls back to the current plate when the index is out of range.
This commit is contained in:
akaitsukiakari authored and GitHub committed 2026-11-03 19:16:35 -06:00
1 parent 0b041740b1
commit 70bc685101
1 file changed
+6
+6
View File
@@ -1144,6 +1144,12 @@ void SyncAmsInfoDialog::reinit_dialog()
m_ams_mapping_result.clear();
m_preview_colors_in_thumbnail.clear();
// The dialog is reused across syncs, so the plate picked last time may no longer exist
// (plates deleted or another project loaded). update_show_status() reads its thumbnail.
PartPlateList &plate_list = wxGetApp().plater()->get_partplate_list();
if (m_specify_plate_idx < 0 || m_specify_plate_idx >= plate_list.get_plate_count())
m_specify_plate_idx = plate_list.get_curr_plate_index();
show_status(PrintDialogStatus::PrintStatusInit);
update_show_status();
}