Fix crash when finding actor or level with empty name text

#2161
This commit is contained in:
Wojtek Figat
2024-01-10 12:12:11 +01:00
parent b7cc4c768f
commit 1094abce5a

View File

@@ -1359,7 +1359,7 @@ bool Actor::IsPrefabRoot() const
Actor* Actor::FindActor(const StringView& name) const
{
Actor* result = nullptr;
if (StringUtils::Compare(*_name, *name) == 0)
if (_name == name)
{
result = const_cast<Actor*>(this);
}
@@ -1393,7 +1393,7 @@ Actor* Actor::FindActor(const MClass* type) const
Actor* Actor::FindActor(const MClass* type, const StringView& name) const
{
CHECK_RETURN(type, nullptr);
if (GetClass()->IsSubClassOf(type) && StringUtils::Compare(*_name, *name) == 0)
if (GetClass()->IsSubClassOf(type) && _name == name)
return const_cast<Actor*>(this);
for (auto child : Children)
{