Skip to content

Commit 34d5ebc

Browse files
committed
Fix game crash if you try to duplicate cart item with empty cart
1 parent aaaa42f commit 34d5ebc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Menus/BuyMenuGUI.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ void BuyMenuGUI::AddCartItem(const std::string &name, const std::string &rightTe
356356
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
357357

358358
void BuyMenuGUI::DuplicateCartItem(const int itemIndex) {
359+
if (m_pCartList->GetItemList()->empty()) {
360+
return;
361+
}
362+
359363
std::vector<GUIListPanel::Item*> addedItems;
360364

361365
auto addDuplicateItemAtEnd = [&](const GUIListPanel::Item *itemToCopy) {

0 commit comments

Comments
 (0)