[Crash] Fix player event crash in ITEM_DESTROY (#4326)

This commit is contained in:
Chris Miles 2024-05-24 20:54:22 -05:00 committed by GitHub
parent e1344039ff
commit 13a7532ef8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5787,21 +5787,19 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
SetIntoxication(GetIntoxication()+IntoxicationIncrease); SetIntoxication(GetIntoxication()+IntoxicationIncrease);
if (player_event_logs.IsEventEnabled(PlayerEvent::ITEM_DESTROY) && inst->GetItem()) {
auto e = PlayerEvent::DestroyItemEvent{
.item_id = inst->GetItem()->ID,
.item_name = inst->GetItem()->Name,
.charges = inst->GetCharges(),
.reason = "Client deleted",
};
RecordPlayerEventLog(PlayerEvent::ITEM_DESTROY, e);
}
} }
DeleteItemInInventory(alc->from_slot, 1); DeleteItemInInventory(alc->from_slot, 1);
if (player_event_logs.IsEventEnabled(PlayerEvent::ITEM_DESTROY)) {
auto e = PlayerEvent::DestroyItemEvent{
.item_id = inst->GetItem()->ID,
.item_name = inst->GetItem()->Name,
.charges = inst->GetCharges(),
.reason = "Client deleted",
};
RecordPlayerEventLog(PlayerEvent::ITEM_DESTROY, e);
}
return;
} }
void Client::Handle_OP_DeleteSpawn(const EQApplicationPacket *app) void Client::Handle_OP_DeleteSpawn(const EQApplicationPacket *app)