Skip to content

Commit

Permalink
Fix quest dialog crash when requesting NPC id is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Sep 7, 2022
1 parent c9bb922 commit 0c4272c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions EndlessClient/Dialogs/QuestDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,22 @@ private void UpdateDialogControls(QuestDialogData repoData)

private void UpdateTitle(QuestDialogData repoData)
{
var npcName = _enfFileProvider.ENFFile[_questDataProvider.RequestedNPC.ID].Name;
var titleText = npcName;
if (!repoData.DialogTitles.ContainsKey(repoData.VendorID) && repoData.DialogTitles.Count == 1)
titleText += $" - {repoData.DialogTitles.Single().Value}";
else if (repoData.DialogTitles.ContainsKey(repoData.VendorID))
titleText += $" - {repoData.DialogTitles[repoData.VendorID]}";

_titleText.Text = titleText;
_titleText.ResizeBasedOnText();
if (_questDataProvider.RequestedNPC != null)
{
var npcName = _enfFileProvider.ENFFile[_questDataProvider.RequestedNPC.ID].Name;
var titleText = npcName;
if (!repoData.DialogTitles.ContainsKey(repoData.VendorID) && repoData.DialogTitles.Count == 1)
titleText += $" - {repoData.DialogTitles.Single().Value}";
else if (repoData.DialogTitles.ContainsKey(repoData.VendorID))
titleText += $" - {repoData.DialogTitles[repoData.VendorID]}";

_titleText.Text = titleText;
_titleText.ResizeBasedOnText();
}
else
{
_titleText.Text = string.Empty;
}
}

private void UpdateDialogDisplayText(QuestDialogData repoData)
Expand Down

0 comments on commit 0c4272c

Please sign in to comment.