mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-22 12:42:49 +00:00
fix(behaviour): don't crash on MissionDialogueOK from an unknown responder
THIS CHANGES SERVER BEHAVIOUR (intentionally); no wire change. The MissionDialogueOK handler (carried over verbatim from GameMessages::HandleMissionDialogOK) dereferenced the responder without a null check, so a client naming an object that doesn't exist crashed the world server. It now logs and ignores the message; the script callback is no longer called with a null player (that path always ended in the crash). Test: handling a MissionDialogueOK with an unknown responder crashes without this change and passes with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -125,8 +125,12 @@ namespace GameMessages {
|
||||
void MissionDialogueOK::Handle(Entity& entityRef, const SystemAddress& sysAddr) {
|
||||
Entity* entity = &entityRef;
|
||||
Entity* player = Game::entityManager->GetEntity(responder);
|
||||
if (!player) {
|
||||
LOG("MissionDialogueOK for mission %i from unknown responder %llu", missionID, responder);
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity) entity->GetScript()->OnMissionDialogueOK(entity, player, missionID, iMissionState);
|
||||
entity->GetScript()->OnMissionDialogueOK(entity, player, missionID, iMissionState);
|
||||
|
||||
// Get the player's mission component
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
Reference in New Issue
Block a user