Fix crash when changing type of SVG / TEXT modifier (#5070)

* Fix crash when changing type of SVG / TEXT modifier
This commit is contained in:
yw4z 2024-04-22 16:37:04 +03:00 committed by GitHub
parent e8018008b3
commit d163cea8f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5025,8 +5025,17 @@ void ObjectList::change_part_type()
}
}
const wxString names[] = { _L("Part"), _L("Negative Part"), _L("Modifier"), _L("Support Blocker"), _L("Support Enforcer") };
SingleChoiceDialog dlg(_L("Type:"), _L("Choose part type"), wxArrayString(5, names), int(type));
// ORCA: Fix crash when changing type of svg / text modifier
wxArrayString names;
names.Add(_L("Part"));
names.Add(_L("Negative Part"));
names.Add(_L("Modifier"));
if (!volume->is_svg() && !volume->is_text()) {
names.Add(_L("Support Blocker"));
names.Add(_L("Support Enforcer"));
}
SingleChoiceDialog dlg(_L("Type:"), _L("Choose part type"), names, int(type));
auto new_type = ModelVolumeType(dlg.GetSingleChoiceIndex());
if (new_type == type || new_type == ModelVolumeType::INVALID)