Fix Crash if something costs 0 in shop (#6106)
This commit is contained in:
parent
856553daf4
commit
df50320ca6
@ -1066,7 +1066,11 @@ static void Task_BuyHowManyDialogueInit(u8 taskId)
|
||||
BuyMenuPrintItemQuantityAndPrice(taskId);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
|
||||
maxQuantity = GetMoney(&gSaveBlock1Ptr->money) / sShopData->totalCost;
|
||||
// Avoid division by zero in-case something costs 0 pokedollars.
|
||||
if (sShopData->totalCost == 0)
|
||||
maxQuantity = MAX_BAG_ITEM_CAPACITY;
|
||||
else
|
||||
maxQuantity = GetMoney(&gSaveBlock1Ptr->money) / sShopData->totalCost;
|
||||
|
||||
if (maxQuantity > MAX_BAG_ITEM_CAPACITY)
|
||||
sShopData->maxQuantity = MAX_BAG_ITEM_CAPACITY;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user