Browse Source

Crash fix on bad quest design

A quest lacking Reload and CurrentStep functions properly working can crash server, this will prevent that
Image 2 years ago
parent
commit
3f3c3f3266
1 changed files with 5 additions and 2 deletions
  1. 5 2
      EQ2/source/WorldServer/client.cpp

+ 5 - 2
EQ2/source/WorldServer/client.cpp

@@ -234,7 +234,7 @@ Client::~Client() {
 void Client::RemoveClientFromZone() {
 	if(player && player->GetZone())
 		player->GetZone()->GetSpellProcess()->RemoveSpellTimersFromSpawn(player, true);
-		
+
 	if (current_zone && player) {
 		if (player->GetGroupMemberInfo())
 		{
@@ -5525,8 +5525,11 @@ void Client::SetPlayerQuest(Quest* quest, map<int32, int32>* progress) {
 				lua_interface->CallQuestFunction(quest, "Reload", player, step->GetStepID());
 		}
 	}
-	if (lua_interface)
+	if (lua_interface && step)
 		lua_interface->CallQuestFunction(quest, "CurrentStep", player, step->GetStepID());
+	else if(!step) {
+		LogWrite(QUEST__ERROR, 0, "Client", "Missing step for quest %s (ID %u), cannot CallQuestFunction for CurrentStep", quest->GetName(), quest->GetQuestID());
+	}
 }
 
 void Client::AddPlayerQuest(Quest* quest, bool call_accepted, bool send_packets) {