Skip to content

Commit

Permalink
fix: Add checks for null when setting prioirty quests
Browse files Browse the repository at this point in the history
Added some checks and logs round prioirty quests to help
track down some bugs which cause a NPE to occur.
  • Loading branch information
pacampbell committed Dec 3, 2024
1 parent 545fc83 commit 90cd208
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Arrowgene.Ddon.GameServer/Handler/QuestSetPriorityQuestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Network;
using Arrowgene.Logging;
using System.Reflection.Metadata.Ecma335;

namespace Arrowgene.Ddon.GameServer.Handler
{
Expand Down Expand Up @@ -34,8 +35,26 @@ public override S2CQuestSetPriorityQuestRes Handle(GameClient client, C2SQuestSe
}

var quest = QuestManager.GetQuestByScheduleId(questScheduleId);
if (quest == null)
{
Logger.Error(client, $"No quest object exists for ${questScheduleId}");
continue;
}

var questStateManager = QuestManager.GetQuestStateManager(client, quest);
if (questStateManager == null)
{
Logger.Error(client, $"Unable to fetch the quest state manager for ${questScheduleId}");
continue;
}

var questState = questStateManager.GetQuestState(questScheduleId);
if (questState == null)
{
Logger.Error(client, $"Failed to find quest state for ${questScheduleId}");
continue;
}

ntc.PriorityQuestList.Add(quest.ToCDataPriorityQuest(questState.Step));
}

Expand Down

0 comments on commit 90cd208

Please sign in to comment.