mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
fix: move InvalidGameObjectId check into SearchById
This commit is contained in:
parent
ed1a6c7810
commit
8feb0a9c53
2 changed files with 4 additions and 2 deletions
|
|
@ -7,7 +7,6 @@ using Dalamud.Game.ClientState.Objects.SubKinds;
|
|||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using JetBrains.Annotations;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Objects
|
||||
|
|
@ -65,6 +64,9 @@ namespace Dalamud.Game.ClientState.Objects
|
|||
/// <returns>A game object or null.</returns>
|
||||
public GameObject? SearchById(uint objectId)
|
||||
{
|
||||
if (objectId is GameObject.InvalidGameObjectId or 0)
|
||||
return null;
|
||||
|
||||
foreach (var obj in this)
|
||||
{
|
||||
if (obj == null)
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// This iterates the actor table, it should be used with care.
|
||||
/// </remarks>
|
||||
// TODO: Fix for non-networked GameObjects
|
||||
public virtual GameObject? TargetObject => this.TargetObjectId != InvalidGameObjectId ? Service<ObjectTable>.Get().SearchById(this.TargetObjectId) : null;
|
||||
public virtual GameObject? TargetObject => Service<ObjectTable>.Get().SearchById(this.TargetObjectId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying structure.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue