Skip to content

Commit

Permalink
#5623: Fix crashing the EntityInspector when a non-entity is selected…
Browse files Browse the repository at this point in the history
… below the root node
  • Loading branch information
codereader committed May 28, 2021
1 parent 130b1e9 commit 756bdda
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion radiant/ui/einspector/EntityInspector.cpp
Expand Up @@ -1194,6 +1194,11 @@ void EntityInspector::getEntityFromSelectionSystem()
scene::INodePtr selectedNodeParent = selectedNode->getParent();
changeSelectedEntity(selectedNodeParent);

if (!_selectedEntity.lock())
{
return;
}

try
{
auto indices = scene::getNodeIndices(selectedNode);
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 756bdda

Please sign in to comment.