Merge pull request #66 from ff-meli/actor_table_crash_fix

fix for at least some of the actor table crashing
This commit is contained in:
goaaats 2020-03-29 15:51:29 +09:00 committed by GitHub
commit b004e80e26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,6 +65,14 @@ namespace Dalamud.Interface
break; break;
case 2: { case 2: {
var stateString = string.Empty; var stateString = string.Empty;
// LocalPlayer is null in a number of situations (at least with the current visible-actors list)
// which would crash here.
if (this.dalamud.ClientState.Actors.Length == 0 || this.dalamud.ClientState.LocalPlayer == null)
{
ImGui.TextUnformatted("Data not ready.");
}
else
{
stateString += $"FrameworkBase: {this.dalamud.Framework.Address.BaseAddress.ToInt64():X}\n"; stateString += $"FrameworkBase: {this.dalamud.Framework.Address.BaseAddress.ToInt64():X}\n";
stateString += $"ActorTableLen: {this.dalamud.ClientState.Actors.Length}\n"; stateString += $"ActorTableLen: {this.dalamud.ClientState.Actors.Length}\n";
@ -89,6 +97,7 @@ namespace Dalamud.Interface
$" Level: {chara.Level} ClassJob: {chara.ClassJob.GameData.Name} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n"; $" Level: {chara.Level} ClassJob: {chara.ClassJob.GameData.Name} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n";
; ;
} }
}
ImGui.TextUnformatted(stateString); ImGui.TextUnformatted(stateString);
} }