Skip to content

Commit

Permalink
Don't allow nameplate GameObject lookup when ObjectId is invalid (#2137)
Browse files Browse the repository at this point in the history
  • Loading branch information
nebel authored Dec 4, 2024
1 parent 4c62158 commit 75f4145
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,22 @@ internal NamePlateUpdateHandler(NamePlateUpdateContext context, int arrayIndex)
public ulong GameObjectId => this.gameObjectId ??= this.NamePlateInfo->ObjectId;

/// <inheritdoc/>
public IGameObject? GameObject => this.gameObject ??= this.context.ObjectTable[
this.context.Ui3DModule->NamePlateObjectInfoPointers[this.ArrayIndex]
.Value->GameObject->ObjectIndex];
public IGameObject? GameObject
{
get
{
if (this.GameObjectId == 0xE0000000)
{
// Skipping Ui3DModule lookup for invalid nameplate (NamePlateInfo->ObjectId is 0xE0000000). This
// prevents crashes around certain Doman Reconstruction cutscenes.
return null;
}

return this.gameObject ??= this.context.ObjectTable[
this.context.Ui3DModule->NamePlateObjectInfoPointers[this.ArrayIndex]
.Value->GameObject->ObjectIndex];
}
}

/// <inheritdoc/>
public IBattleChara? BattleChara => this.GameObject as IBattleChara;
Expand Down

0 comments on commit 75f4145

Please sign in to comment.