[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,10 +5787,7 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
SetIntoxication(GetIntoxication()+IntoxicationIncrease);
}
DeleteItemInInventory(alc->from_slot, 1);
if (player_event_logs.IsEventEnabled(PlayerEvent::ITEM_DESTROY)) {
if (player_event_logs.IsEventEnabled(PlayerEvent::ITEM_DESTROY) && inst->GetItem()) {
auto e = PlayerEvent::DestroyItemEvent{
.item_id = inst->GetItem()->ID,
.item_name = inst->GetItem()->Name,
@ -5800,8 +5797,9 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
RecordPlayerEventLog(PlayerEvent::ITEM_DESTROY, e);
}
}
return;
DeleteItemInInventory(alc->from_slot, 1);
}
void Client::Handle_OP_DeleteSpawn(const EQApplicationPacket *app)