Fix crash with depsgraph iterator and empty scene.

This causes crashes in the view layer tests.
This commit is contained in:
Brecht Van Lommel 2018-04-25 19:03:49 +02:00
parent a31807ed7c
commit d60be68100
1 changed files with 8 additions and 4 deletions

View File

@ -205,6 +205,7 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data)
const size_t num_id_nodes = deg_graph->id_nodes.size();
if (num_id_nodes == 0) {
iter->data = NULL;
iter->valid = false;
return;
}
@ -265,10 +266,13 @@ void DEG_iterator_objects_end(BLI_Iterator *iter)
{
#ifndef NDEBUG
DEGObjectIterData *data = (DEGObjectIterData *)iter->data;
/* Force crash in case the iterator data is referenced and accessed down
* the line. (T51718)
*/
memset(&data->temp_dupli_object, 0xff, sizeof(data->temp_dupli_object));
if (data) {
/* Force crash in case the iterator data is referenced and accessed down
* the line. (T51718)
*/
memset(&data->temp_dupli_object, 0xff, sizeof(data->temp_dupli_object));
}
#else
(void) iter;
#endif