Merge pull request #10327 from kubecz3k/fix-spatial-crash
fix crash after click on MeshInstance with no owner
This commit is contained in:
commit
447f7644b0
@ -276,19 +276,19 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
|
||||
|
||||
Ref<SpatialEditorGizmo> seg = spat->get_gizmo();
|
||||
|
||||
if (!seg.is_valid() || found_gizmos.has(seg)){
|
||||
if (!seg.is_valid() || found_gizmos.has(seg)) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
found_gizmos.insert(seg);
|
||||
Vector3 point;
|
||||
Vector3 normal;
|
||||
@ -331,7 +331,6 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
|
||||
results.push_back(res);
|
||||
}
|
||||
|
||||
|
||||
if (results.empty())
|
||||
return 0;
|
||||
|
||||
@ -765,8 +764,7 @@ void SpatialEditorViewport::_list_select(InputEventMouseButton b) {
|
||||
selection_menu->add_item(spat->get_name());
|
||||
selection_menu->set_item_icon(i, icon);
|
||||
selection_menu->set_item_metadata(i, node_path);
|
||||
selection_menu->set_item_tooltip(i, String(spat->get_name()) +
|
||||
"\nType: " + spat->get_type() + "\nPath: " + node_path);
|
||||
selection_menu->set_item_tooltip(i, String(spat->get_name()) + "\nType: " + spat->get_type() + "\nPath: " + node_path);
|
||||
}
|
||||
|
||||
selection_menu->set_global_pos(Vector2(b.global_x, b.global_y));
|
||||
|
Loading…
Reference in New Issue
Block a user