mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
fix: use after free in mission progression after removing item from inventory
that method is cursed. no longer has ub when deleting an item from the inventory
This commit is contained in:
parent
4d1395e522
commit
c06f96b55f
@ -5354,14 +5354,14 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream& inStream, En
|
||||
if (eInvType == eInventoryType::MODELS) {
|
||||
item->DisassembleModel(iStackCount);
|
||||
}
|
||||
|
||||
auto lot = item->GetLot();
|
||||
item->SetCount(item->GetCount() - iStackCount, true);
|
||||
Game::entityManager->SerializeEntity(entity);
|
||||
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->Progress(eMissionTaskType::GATHER, item->GetLot(), LWOOBJID_EMPTY, "", -iStackCount);
|
||||
missionComponent->Progress(eMissionTaskType::GATHER, lot, LWOOBJID_EMPTY, "", -iStackCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user