summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorJakub Grzesik <kubecz3k@gmail.com>2017-08-11 19:59:30 +0200
committerJakub Grzesik <kubecz3k@gmail.com>2017-08-11 19:59:30 +0200
commitbe8ae8df938765e5d218c5ec781c85ea8fe43bf8 (patch)
tree824c33fea4d74225713b2c52ad5ee15ddaa93e09 /editor/plugins
parent23f6d3fa69935c90c6cdcee342ae99d226e9b4ab (diff)
fix crash after click on MeshInstance with no owner
Due to how spatial selection works, after clicking on MeshInstance that had no owner editor was crashing.
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index a549f09cb1..13fdb7ac9d 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -285,11 +285,11 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
Node *subscene_candidate = spat;
- while (subscene_candidate->get_owner() != editor->get_edited_scene())
+ while ((subscene_candidate->get_owner() != NULL) && (subscene_candidate->get_owner() != editor->get_edited_scene()))
subscene_candidate = subscene_candidate->get_owner();
spat = subscene_candidate->cast_to<Spatial>();
- if (spat && (spat->get_filename() != ""))
+ if (spat && (spat->get_filename() != "") && (subscene_candidate->get_owner() != NULL))
subscenes.push_back(spat);
continue;