mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 21:15:33 +00:00
Do not use unchecked value in calculations
This commit is contained in:
parent
903b89a0ff
commit
1db369f418
1 changed files with 2 additions and 3 deletions
|
@ -393,7 +393,8 @@ namespace MWGui
|
|||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
if (MyGUI::utility::parseInt(mPriceLabel->getCaption()) > playerGold)
|
||||
int price = MyGUI::utility::parseInt(mPriceLabel->getCaption());
|
||||
if (price > playerGold)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}");
|
||||
return;
|
||||
|
@ -401,8 +402,6 @@ namespace MWGui
|
|||
|
||||
mSpell.mName = mNameEdit->getCaption();
|
||||
|
||||
int price = MyGUI::utility::parseInt(mPriceLabel->getCaption());
|
||||
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
|
||||
// add gold to NPC trading gold pool
|
||||
|
|
Loading…
Reference in a new issue