fix: filter InvalidGameObjectId when getting ToT

This commit is contained in:
goat 2021-08-27 01:42:38 +02:00
parent 1ae42607d3
commit ed1a6c7810
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -12,6 +12,11 @@ namespace Dalamud.Game.ClientState.Objects.Types
/// </summary>
public unsafe partial class GameObject : IEquatable<GameObject>
{
/// <summary>
/// IDs of non-networked GameObjects.
/// </summary>
public const uint InvalidGameObjectId = 0xE0000000;
/// <summary>
/// Initializes a new instance of the <see cref="GameObject"/> class.
/// </summary>
@ -156,7 +161,8 @@ namespace Dalamud.Game.ClientState.Objects.Types
/// <remarks>
/// This iterates the actor table, it should be used with care.
/// </remarks>
public virtual GameObject? TargetObject => Service<ObjectTable>.Get().SearchById(this.TargetObjectId);
// TODO: Fix for non-networked GameObjects
public virtual GameObject? TargetObject => this.TargetObjectId != InvalidGameObjectId ? Service<ObjectTable>.Get().SearchById(this.TargetObjectId) : null;
/// <summary>
/// Gets the underlying structure.