Fix get_model_volume always returning nullptr;

This commit is contained in:
tamasmeszaros 2023-02-27 14:52:28 +01:00
parent ec0a3658b0
commit 4bb92e9c51

View File

@ -7100,14 +7100,12 @@ const ModelVolume *get_model_volume(const GLVolume &v, const Model &model)
{ {
const ModelVolume * ret = nullptr; const ModelVolume * ret = nullptr;
if (model.objects.size() < v.object_idx()) {
if (v.object_idx() < model.objects.size()) { if (v.object_idx() < model.objects.size()) {
const ModelObject *obj = model.objects[v.object_idx()]; const ModelObject *obj = model.objects[v.object_idx()];
if (v.volume_idx() < obj->volumes.size()) { if (v.volume_idx() < obj->volumes.size()) {
ret = obj->volumes[v.volume_idx()]; ret = obj->volumes[v.volume_idx()];
} }
} }
}
return ret; return ret;
} }