Fixed crash after deleting of the part with no extruder options in configuration

This commit is contained in:
YuSanka 2019-03-14 09:22:15 +01:00
parent 5ecd78434c
commit 7cced0613a

View file

@ -1761,7 +1761,8 @@ void ObjectList::delete_from_model_and_list(const std::vector<ItemForDelete>& it
if (item->type&itVolume)
{
m_objects_model->Delete(m_objects_model->GetItemByVolumeId(item->obj_idx, item->sub_obj_idx));
if ((*m_objects)[item->obj_idx]->volumes.size() == 1)
if ((*m_objects)[item->obj_idx]->volumes.size() == 1 &&
(*m_objects)[item->obj_idx]->config.has("extruder"))
{
const wxString extruder = wxString::Format("%d", (*m_objects)[item->obj_idx]->config.option<ConfigOptionInt>("extruder")->value);
m_objects_model->SetValue(extruder, m_objects_model->GetItemById(item->obj_idx), 1);