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 d74e60d
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Arrowgene.Ddon.GameServer.Characters;
using Arrowgene.Ddon.Server;
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Network;
using Arrowgene.Logging;

namespace Arrowgene.Ddon.GameServer.Handler
Expand Down Expand Up @@ -34,8 +33,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 d74e60d

Please sign in to comment.