mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
fix stale reference (#1594)
This commit is contained in:
parent
f0960d48b2
commit
8ae1a8ff7c
@ -76,8 +76,8 @@ void VendorComponent::RefreshInventory(bool isCreation) {
|
|||||||
if (vendorItems.empty()) break;
|
if (vendorItems.empty()) break;
|
||||||
auto randomItemIndex = GeneralUtils::GenerateRandomNumber<int32_t>(0, vendorItems.size() - 1);
|
auto randomItemIndex = GeneralUtils::GenerateRandomNumber<int32_t>(0, vendorItems.size() - 1);
|
||||||
const auto& randomItem = vendorItems.at(randomItemIndex);
|
const auto& randomItem = vendorItems.at(randomItemIndex);
|
||||||
vendorItems.erase(vendorItems.begin() + randomItemIndex);
|
|
||||||
if (SetupItem(randomItem.itemid)) m_Inventory.push_back(SoldItem(randomItem.itemid, randomItem.sortPriority));
|
if (SetupItem(randomItem.itemid)) m_Inventory.push_back(SoldItem(randomItem.itemid, randomItem.sortPriority));
|
||||||
|
vendorItems.erase(vendorItems.begin() + randomItemIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user