Fix Variant getters returning already freed managed handles

This commit is contained in:
2024-06-01 20:22:16 +03:00
parent e0791eacad
commit dedb3d57fd
8 changed files with 14 additions and 14 deletions

View File

@@ -212,7 +212,7 @@ bool BehaviorKnowledge::HasGoal(ScriptingTypeHandle type) const
return false;
}
Variant BehaviorKnowledge::GetGoal(ScriptingTypeHandle type)
const Variant& BehaviorKnowledge::GetGoal(ScriptingTypeHandle type) const
{
for (const Variant& goal : Goals)
{

View File

@@ -101,7 +101,7 @@ public:
/// </summary>
/// <param name="type">The goal type.</param>
/// <returns>The goal value or null if not found.</returns>
API_FUNCTION() Variant GetGoal(ScriptingTypeHandle type);
API_FUNCTION() const Variant& GetGoal(ScriptingTypeHandle type) const;
/// <summary>
/// Adds the goal to the knowledge. If goal of that type already exists then it's value is updated.