Skip to content

Commit

Permalink
Fix issue #1275 - wielded index greater than inv size.
Browse files Browse the repository at this point in the history
  • Loading branch information
RealBadAngel committed Jun 17, 2014
1 parent a0f7865 commit cb3b42e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/game.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit cb3b42e

Please sign in to comment.