From 756bddaabeaea8c37bf7929b164e6e2c57a25c04 Mon Sep 17 00:00:00 2001 From: codereader Date: Fri, 28 May 2021 17:16:43 +0200 Subject: [PATCH] #5623: Fix crashing the EntityInspector when a non-entity is selected below the root node --- radiant/ui/einspector/EntityInspector.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/radiant/ui/einspector/EntityInspector.cpp b/radiant/ui/einspector/EntityInspector.cpp index 4456bb36a8..046035d3bd 100644 --- a/radiant/ui/einspector/EntityInspector.cpp +++ b/radiant/ui/einspector/EntityInspector.cpp @@ -1194,6 +1194,11 @@ void EntityInspector::getEntityFromSelectionSystem() scene::INodePtr selectedNodeParent = selectedNode->getParent(); changeSelectedEntity(selectedNodeParent); + if (!_selectedEntity.lock()) + { + return; + } + try { auto indices = scene::getNodeIndices(selectedNode); @@ -1243,7 +1248,7 @@ void EntityInspector::changeSelectedEntity(const scene::INodePtr& newEntity) _keyValueTreeView->ResetSortingOnAllColumns(); // Attach to new entity if it is non-NULL - if (newEntity) + if (newEntity && newEntity->getNodeType() == scene::INode::Type::Entity) { _selectedEntity = newEntity;