summaryrefslogtreecommitdiff
path: root/src/gui/windows/buydialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-30 15:11:07 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-30 15:11:07 +0300
commitc3bb4f8f2eff05ccdb8a3f9ef58fc741eedfaa79 (patch)
treedc164a33a3732de36fcca452cc19841ed3663ff1 /src/gui/windows/buydialog.cpp
parent9c6f59308ebf8d488e0949c76e7c452876fe753f (diff)
downloadplus-c3bb4f8f2eff05ccdb8a3f9ef58fc741eedfaa79.tar.gz
plus-c3bb4f8f2eff05ccdb8a3f9ef58fc741eedfaa79.tar.bz2
plus-c3bb4f8f2eff05ccdb8a3f9ef58fc741eedfaa79.tar.xz
plus-c3bb4f8f2eff05ccdb8a3f9ef58fc741eedfaa79.zip
Fix issies found by gcc 6 in paranoid mode.
Diffstat (limited to 'src/gui/windows/buydialog.cpp')
-rw-r--r--src/gui/windows/buydialog.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index fa7297bdd..9dd083d61 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -617,7 +617,11 @@ void BuyDialog::updateSlider(const int selectedItem)
// Update money and adjust the max number of items
// that can be bought
mMaxItems -= mAmountItems;
- setMoney(mMoney - mAmountItems * mShopItems->at(selectedItem)->getPrice());
+ const ShopItem *const item = mShopItems->at(selectedItem);
+ if (item)
+ setMoney(mMoney - mAmountItems * item->getPrice());
+ else
+ setMoney(mMoney);
// Reset selection
mAmountItems = 1;