Fix possible buffer overreach when selecting a shop item

Thanks to @fosnola for the fix.
This commit is contained in:
2023-01-18 09:56:14 -05:00
parent 20102c7f52
commit 924692c1dd

View File

@@ -220,7 +220,9 @@ void handle_shop_event(location p) {
}
for(short i = 0; i < 8; i++) {
unsigned long what_picked = shop_array[i + shop_sbar->getPosition()];
auto shop_i = i + shop_sbar->getPosition();
if(shop_i >= shop_array.size()) break;
unsigned long what_picked = shop_array[shop_i];
if(what_picked >= active_shop.size()) break;
if(active_shop.getItem(what_picked).type == eShopItemType::EMPTY)
break;