aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRealBadAngel <maciej.kasatkin@o2.pl>2014-06-17 13:03:24 +0200
committerRealBadAngel <maciej.kasatkin@o2.pl>2014-06-17 14:17:53 +0200
commitcb3b42efe47fcf53527c033654878635c7c3f39c (patch)
tree71be7981b9548db9cd6e640ddb738878914ac6af /src
parenta0f78659f31abdce973bc6641b5b5a58f2ba9afc (diff)
downloadminetest-cb3b42efe47fcf53527c033654878635c7c3f39c.tar.gz
minetest-cb3b42efe47fcf53527c033654878635c7c3f39c.tar.bz2
minetest-cb3b42efe47fcf53527c033654878635c7c3f39c.zip
Fix issue #1275 - wielded index greater than inv size.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 609ca1a1a..c2ee7f311 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -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());
}