safety check for scroll to after paste entity

This commit is contained in:
SHAM-DP 2023-02-28 15:36:45 +08:00
parent 5b5a9342c3
commit 7e34edecdd
1 changed files with 2 additions and 1 deletions

View File

@ -49,7 +49,8 @@ namespace SHADE
data.createdEntities.clear(); data.createdEntities.clear();
data.createdEntities = SHSerialization::DeserializeEntitiesFromString(data.entityData, data.parentEID); data.createdEntities = SHSerialization::DeserializeEntitiesFromString(data.entityData, data.parentEID);
data.entityData = SHSerialization::ResolveSerializedEntityIndices(data.entityData, data.createdEntities); data.entityData = SHSerialization::ResolveSerializedEntityIndices(data.entityData, data.createdEntities);
SHEditorWindowManager::GetEditorWindow<SHHierarchyPanel>()->SetScrollTo(data.createdEntities.begin()->second); if(!data.createdEntities.empty())
SHEditorWindowManager::GetEditorWindow<SHHierarchyPanel>()->SetScrollTo(data.createdEntities.begin()->second);
} }
void SHPasteEntitiesCommand::Undo() void SHPasteEntitiesCommand::Undo()