diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-06 17:38:17 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-06 17:40:23 +0300 |
commit | 4cdb4b9532c8151ec9f1caba7a764c4f5a334f30 (patch) | |
tree | 17ef56ee61cac93358bfe0802e2eb1976bcb33c2 /source/blender/depsgraph/intern/depsgraph_query.cc | |
parent | 958e00cebfe122fd0a0a144612361fc8632f981b (diff) |
Fix T64161: Crashing using undo and multiple windows
It is possible that dependency graph was not yet initialized,
so need to do NULL pointer check.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_query.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_query.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index a653366a588..75eabc6930f 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -152,6 +152,19 @@ Scene *DEG_get_evaluated_scene(const Depsgraph *graph) return scene_cow; } +Scene *DEG_get_evaluated_scene_if_exists(const Depsgraph *graph) +{ + if (graph == NULL) { + return NULL; + } + const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph); + Scene *scene_cow = deg_graph->scene_cow; + if (scene_cow == NULL || !DEG::deg_copy_on_write_is_expanded(&scene_cow->id)) { + return NULL; + } + return scene_cow; +} + ViewLayer *DEG_get_evaluated_view_layer(const Depsgraph *graph) { const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph); |