Fix issue #1275 - wielded index greater than inv size.
This commit is contained in:
parent
a0f78659f3
commit
cb3b42efe4
|
@ -2581,11 +2581,9 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
|
||||||
ItemStack playeritem;
|
ItemStack playeritem;
|
||||||
{
|
{
|
||||||
InventoryList *mlist = local_inventory.getList("main");
|
InventoryList *mlist = local_inventory.getList("main");
|
||||||
if(mlist != NULL)
|
if((mlist != NULL) && (client.getPlayerItem() < mlist->getSize()))
|
||||||
{
|
|
||||||
playeritem = mlist->getItem(client.getPlayerItem());
|
playeritem = mlist->getItem(client.getPlayerItem());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const ItemDefinition &playeritem_def =
|
const ItemDefinition &playeritem_def =
|
||||||
playeritem.getDefinition(itemdef);
|
playeritem.getDefinition(itemdef);
|
||||||
ToolCapabilities playeritem_toolcap =
|
ToolCapabilities playeritem_toolcap =
|
||||||
|
@ -3332,7 +3330,7 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
|
||||||
// Update wielded tool
|
// Update wielded tool
|
||||||
InventoryList *mlist = local_inventory.getList("main");
|
InventoryList *mlist = local_inventory.getList("main");
|
||||||
ItemStack item;
|
ItemStack item;
|
||||||
if(mlist != NULL)
|
if((mlist != NULL) && (client.getPlayerItem() < mlist->getSize()))
|
||||||
item = mlist->getItem(client.getPlayerItem());
|
item = mlist->getItem(client.getPlayerItem());
|
||||||
camera.wield(item, client.getPlayerItem());
|
camera.wield(item, client.getPlayerItem());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue