Fix #145321: Crash with Viewer Node on Values without Geometry
Don't init duplis if `dupli_list` is empty. Otherwise, the `data->dupli_parent` "leaks" into the next objects. This also asserts that dupli iteration properties are set to default values when calling `deg_iterator_duplis_init`. Pull Request: https://projects.blender.org/blender/blender/pulls/145407
This commit is contained in:
@@ -90,9 +90,17 @@ bool deg_object_hide_original(eEvaluationMode eval_mode, const Object *ob, const
|
||||
|
||||
void deg_iterator_duplis_init(DEGObjectIterData *data, Object *object)
|
||||
{
|
||||
/* This should have been set to default values at `DEG_iterator_objects_begin`, or at the end of
|
||||
* the previous `deg_iterator_duplis_step` cycle. */
|
||||
BLI_assert(data->dupli_parent == nullptr);
|
||||
BLI_assert(data->dupli_object_next == nullptr);
|
||||
BLI_assert(data->dupli_object_next_index == -1);
|
||||
if (data->dupli_list.is_empty()) {
|
||||
return;
|
||||
}
|
||||
data->dupli_parent = object;
|
||||
data->dupli_object_next = data->dupli_list.is_empty() ? nullptr : &data->dupli_list.first();
|
||||
data->dupli_object_next_index = data->dupli_object_next ? 0 : -1;
|
||||
data->dupli_object_next = &data->dupli_list.first();
|
||||
data->dupli_object_next_index = 0;
|
||||
}
|
||||
|
||||
/* Returns false when iterator is exhausted. */
|
||||
|
||||
Reference in New Issue
Block a user