From 312c6c4f076518efc4ab45a2155d7dbabbb1c58f Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Thu, 30 May 2024 22:37:42 +0300 Subject: [PATCH] fixed potential crash when undoing asset instantiation --- editor/src/world/graph/selection.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/editor/src/world/graph/selection.rs b/editor/src/world/graph/selection.rs index 13b2dd11b..bbf1408e5 100644 --- a/editor/src/world/graph/selection.rs +++ b/editor/src/world/graph/selection.rs @@ -5,6 +5,7 @@ use crate::fyrox::{ }; use crate::scene::SelectionContainer; use crate::utils; +use fyrox::graph::BaseSceneGraph; #[derive(Debug, Default, Clone, Eq)] pub struct GraphSelection { @@ -99,7 +100,11 @@ impl GraphSelection { graph: &Graph, ) -> Option<(UnitQuaternion, Vector3)> { if self.is_single_selection() { - Some(graph.global_rotation_position_no_scale(self.nodes[0])) + if graph.is_valid_handle(self.nodes[0]) { + Some(graph.global_rotation_position_no_scale(self.nodes[0])) + } else { + None + } } else if self.is_empty() { None } else {