From be8ae8df938765e5d218c5ec781c85ea8fe43bf8 Mon Sep 17 00:00:00 2001 From: Jakub Grzesik Date: Fri, 11 Aug 2017 19:59:30 +0200 Subject: 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. --- editor/plugins/spatial_editor_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editor/plugins') 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(); - if (spat && (spat->get_filename() != "")) + if (spat && (spat->get_filename() != "") && (subscene_candidate->get_owner() != NULL)) subscenes.push_back(spat); continue; -- cgit v1.2.3