From 75f414578d26cc021f2d79a061079c6804bbad7f Mon Sep 17 00:00:00 2001
From: nebel <9887+nebel@users.noreply.github.com>
Date: Thu, 5 Dec 2024 06:23:17 +0900
Subject: [PATCH] Don't allow nameplate GameObject lookup when ObjectId is
invalid (#2137)
---
.../Gui/NamePlate/NamePlateUpdateHandler.cs | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs
index 94f185966..4f16ab660 100644
--- a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs
+++ b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs
@@ -328,9 +328,22 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler
public ulong GameObjectId => this.gameObjectId ??= this.NamePlateInfo->ObjectId;
///
- 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];
+ }
+ }
///
public IBattleChara? BattleChara => this.GameObject as IBattleChara;