Skip to content

Commit

Permalink
Fixes bug with invalid index on manual category sort (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdiega authored Oct 29, 2022
1 parent 36a8e10 commit d714c3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/shop/item_manager.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -2575,4 +2575,4 @@ void CopyKeyValuesKeys(KeyValues input, KeyValues output)
while(input.GotoNextKey(false));
input.GoBack();
}
}
}

0 comments on commit d714c3b

Please sign in to comment.