mirror of
https://github.com/pret/pokeemerald.git
synced 2026-09-10 03:56:24 -05:00
Fix Crash if something costs 0 in shop (#6106)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user