From d714c3b8f116c7f603c2e492a6b2f804c1c8576e Mon Sep 17 00:00:00 2001 From: mrdiega <79888956+mrdiega@users.noreply.github.com> Date: Sat, 29 Oct 2022 21:05:14 +0300 Subject: [PATCH] Fixes bug with invalid index on manual category sort (#152) --- addons/sourcemod/scripting/shop/item_manager.sp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sourcemod/scripting/shop/item_manager.sp b/addons/sourcemod/scripting/shop/item_manager.sp index 29ab540..4d42077 100644 --- a/addons/sourcemod/scripting/shop/item_manager.sp +++ b/addons/sourcemod/scripting/shop/item_manager.sp @@ -1384,7 +1384,7 @@ bool ItemManager_FillCategories(Menu menu, int source_client, ShopMenu shop_menu { g_hSortArray.GetString(i, category, sizeof(category)); index = hCategoriesArray.FindString(category); - if(index != -1 && index != x) + if(index != -1 && index != x && x < hCategoriesArray.Length) { hCategoriesArray.SwapAt(index, x); } @@ -2575,4 +2575,4 @@ void CopyKeyValuesKeys(KeyValues input, KeyValues output) while(input.GotoNextKey(false)); input.GoBack(); } -} \ No newline at end of file +}