mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-24 22:43:34 +00:00
fix: use after free in mission progression after removing item from inventory (#1567)
that method is cursed. no longer has ub when deleting an item from the inventory
This commit is contained in:
parent
4d1395e522
commit
9f382aca42
@ -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