Fixed crash when calling Reload from disk command after slicing on SLA printer

This commit is contained in:
Enrico Turri 2019-11-25 14:42:36 +01:00
parent df3e47e093
commit 44d7ac4474

View file

@ -3177,9 +3177,13 @@ void Plater::priv::reload_from_disk()
for (unsigned int idx : selected_volumes_idxs)
{
const GLVolume* v = selection.get_volume(idx);
int o_idx = v->object_idx();
int v_idx = v->volume_idx();
selected_volumes.push_back({ o_idx, v_idx });
if (v_idx >= 0)
{
int o_idx = v->object_idx();
if ((0 <= o_idx) && (o_idx < (int)model.objects.size()))
selected_volumes.push_back({ o_idx, v_idx });
}
}
std::sort(selected_volumes.begin(), selected_volumes.end());
selected_volumes.erase(std::unique(selected_volumes.begin(), selected_volumes.end()), selected_volumes.end());