From 2e44873ac987c484ef7f9ace5eeabfd376f6d8f8 Mon Sep 17 00:00:00 2001 From: est31 Date: Wed, 1 Jul 2015 17:03:02 +0200 Subject: [PATCH] Inventory manager style cleanup and further checks --- src/inventorymanager.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index 96ce48086..d23d1529d 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -172,16 +172,16 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame Inventory *inv_from = mgr->getInventory(from_inv); Inventory *inv_to = mgr->getInventory(to_inv); - if(!inv_from){ - infostream<<"IMoveAction::apply(): FAIL: source inventory not found: " - <<"from_inv=\""< list_to->getSize()) { + infostream << "IMoveAction::apply(): FAIL: destination index out of bounds: " + << "to_i=" << to_i + << ", size=" << list_to->getSize() << std::endl; + return; + } /* Do not handle rollback if both inventories are that of the same player */