mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-10 15:39:02 +00:00
Do not use unchecked value in calculations
This commit is contained in:
parent
903b89a0ff
commit
1db369f418
@ -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 New Issue
Block a user