diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-06-19 19:40:41 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-06-19 19:40:41 +0300 |
commit | 748340fad59abc6da2369455c268d6a66c738e69 (patch) | |
tree | 8e6a6913caf782d88ac266136075abf447208ea3 /src | |
parent | bf947833e980b82a31f0570d775d23c2a0d1b56b (diff) | |
download | minetest-748340fad59abc6da2369455c268d6a66c738e69.tar.gz minetest-748340fad59abc6da2369455c268d6a66c738e69.tar.bz2 minetest-748340fad59abc6da2369455c268d6a66c738e69.zip |
fixed a segfault in case of wrong input from network on the server (reported by spongie)
Diffstat (limited to 'src')
-rw-r--r-- | src/inventory.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index 03df98de6..0c76ed845 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -470,7 +470,7 @@ InventoryItem * InventoryList::addItem(u32 i, InventoryItem *newitem) //setDirty(true); // If it is an empty position, it's an easy job. - InventoryItem *to_item = m_items[i]; + InventoryItem *to_item = getItem(i); if(to_item == NULL) { m_items[i] = newitem; @@ -502,7 +502,7 @@ InventoryItem * InventoryList::addItem(u32 i, InventoryItem *newitem) bool InventoryList::itemFits(u32 i, InventoryItem *newitem) { // If it is an empty position, it's an easy job. - InventoryItem *to_item = m_items[i]; + InventoryItem *to_item = getItem(i); if(to_item == NULL) { return true; @@ -528,7 +528,7 @@ InventoryItem * InventoryList::takeItem(u32 i, u32 count) //setDirty(true); - InventoryItem *item = m_items[i]; + InventoryItem *item = getItem(i); // If it is an empty position, return NULL if(item == NULL) return NULL; |