Don't allow nameplate GameObject lookup when ObjectId is invalid (#2137)

This commit is contained in:
nebel 2024-12-05 06:23:17 +09:00 committed by GitHub
parent 4c62158aea
commit 75f414578d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -328,9 +328,22 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler
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;