From af7c2d28c320249a6ce390e60aa92218b3f3080d Mon Sep 17 00:00:00 2001 From: ducphamhong Date: Fri, 13 May 2022 18:08:58 +0700 Subject: [PATCH] #123 Fix some thing (crash on null handler) --- .../Editor/SpaceController/CSceneController.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Projects/Editor/Source/Editor/SpaceController/CSceneController.cpp b/Projects/Editor/Source/Editor/SpaceController/CSceneController.cpp index 0755d04c4..7dbff4547 100644 --- a/Projects/Editor/Source/Editor/SpaceController/CSceneController.cpp +++ b/Projects/Editor/Source/Editor/SpaceController/CSceneController.cpp @@ -909,15 +909,17 @@ namespace Skylicht { // delete entity CEntityHandleData* data = entity->getData(); + if (data != NULL) + { + CEntityHandler* handler = data->Handler; + handler->removeEntity(entity); - CEntityHandler* handler = data->Handler; - handler->removeEntity(entity); - - // remove gui hierachy - if (m_spaceHierarchy != NULL) - m_spaceHierarchy->getController()->updateTreeNode(handler->getGameObject()); + // remove gui hierachy + if (m_spaceHierarchy != NULL) + m_spaceHierarchy->getController()->updateTreeNode(handler->getGameObject()); - modifyGameObjects.push_back(handler->getGameObject()); + modifyGameObjects.push_back(handler->getGameObject()); + } } } }