Merge pull request #787 from Ottermandias/ContextNullCheck

This commit is contained in:
goaaats 2022-04-14 02:03:39 +02:00 committed by GitHub
commit 3b4b9784fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
@ -456,11 +456,16 @@ namespace Dalamud.Game.Gui.ContextMenus
var redButtonActions = &((OldAgentContext*)this.agentContextInterface)->Items->RedButtonActions;
*(redButtonActions + contextMenuItemIndex) = action;
}
else
else if (((AgentContext*)this.agentContextInterface)->Items != null)
{
// TODO: figure out why this branch is reached on inventory contexts and why Items is sometimes null.
var actions = &((OldAgentContext*)this.agentContextInterface)->Items->Actions;
*(actions + this.FirstContextMenuItemIndex + contextMenuItemIndex) = action;
}
else
{
PluginLog.Warning("Context Menu action failed, Items pointer was unexpectedly null.");
}
if (contextMenuItem.Indicator == ContextMenuItemIndicator.Previous)
{