Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-08-02 18:15:56 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-08-02 18:17:04 +0300
commit9914c05bd762d495fe3778c417ba1c7c9d7f1332 (patch)
treee7d0bf0ff555cc1070c85b4d01397c2f28acf2b3 /source/blender/depsgraph/intern/depsgraph_query.cc
parent771973869d293f188687ffa88572e1c4e9946aae (diff)
Depsgraph: fix some DEG queries crashing with new, empty graph.
Calling code is responsible to check on NULL pointers here, or ensure is does have a fully built and evaluated depsgraph, but this should never crash in DEG queries themselves.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_query.cc')
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index ca9f32d4d8c..a6c930196ef 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -128,10 +128,10 @@ Scene *DEG_get_evaluated_scene(const Depsgraph *graph)
reinterpret_cast<const DEG::Depsgraph *>(graph);
Scene *scene_cow = deg_graph->scene_cow;
/* TODO(sergey): Shall we expand datablock here? Or is it OK to assume
- * that calleer is OK with just a pointer in case scene is not up[dated
+ * that calleer is OK with just a pointer in case scene is not updated
* yet?
*/
- BLI_assert(DEG::deg_copy_on_write_is_expanded(&scene_cow->id));
+ BLI_assert(scene_cow != NULL && DEG::deg_copy_on_write_is_expanded(&scene_cow->id));
return scene_cow;
}
@@ -140,6 +140,9 @@ ViewLayer *DEG_get_evaluated_view_layer(const Depsgraph *graph)
const DEG::Depsgraph *deg_graph =
reinterpret_cast<const DEG::Depsgraph *>(graph);
Scene *scene_cow = DEG_get_evaluated_scene(graph);
+ if (scene_cow == NULL) {
+ return NULL; /* Happens with new, not-yet-built/evaluated graphes. */
+ }
/* Do name-based lookup. */
/* TODO(sergey): Can this be optimized? */
ViewLayer *view_layer_orig = deg_graph->view_layer;