From 610b19c083565f1f6c153fadff80fc0e7475168f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 2 Feb 2015 02:06:43 +0300 Subject: Fix wening shop if item amount in shop more than present in cart. --- src/gui/windows/shopwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gui/windows/shopwindow.cpp') 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::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(items.size()) >= mSellShopSize) -- cgit v1.2.3-60-g2f50