Skip to content
Snippets Groups Projects
Commit cb3b42ef authored by RealBadAngel's avatar RealBadAngel
Browse files

Fix issue #1275 - wielded index greater than inv size.

parent a0f78659
No related branches found
No related tags found
No related merge requests found
......@@ -2581,10 +2581,8 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
ItemStack playeritem;
{
InventoryList *mlist = local_inventory.getList("main");
if(mlist != NULL)
{
if((mlist != NULL) && (client.getPlayerItem() < mlist->getSize()))
playeritem = mlist->getItem(client.getPlayerItem());
}
}
const ItemDefinition &playeritem_def =
playeritem.getDefinition(itemdef);
......@@ -3332,7 +3330,7 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
// Update wielded tool
InventoryList *mlist = local_inventory.getList("main");
ItemStack item;
if(mlist != NULL)
if((mlist != NULL) && (client.getPlayerItem() < mlist->getSize()))
item = mlist->getItem(client.getPlayerItem());
camera.wield(item, client.getPlayerItem());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment