summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/windows/shopwindow.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 2541ae247..a845d3404 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -287,6 +287,8 @@ void ShopWindow::action(const ActionEvent &event)
FOR_EACH (std::vector<ShopItem*>::iterator, it, oldItems)
{
ShopItem *const item = *it;
+ if (!item)
+ continue;
// +++ need add colors
Item *const cartItem = inv->findItem(item->getId(), 1);
if (!cartItem)
@@ -295,7 +297,7 @@ void ShopWindow::action(const ActionEvent &event)
const int amount = cartItem->getQuantity();
if (!amount)
continue;
- if (item->getQuantity() < amount)
+ if (item->getQuantity() > amount)
item->setQuantity(amount);
items.push_back(item);
if (static_cast<signed int>(items.size()) >= mSellShopSize)