If there was no source item in a furnace it would cause a segmentation fault.
authorJacobF <queatz@gmail.com>
Tue, 30 Aug 2011 15:38:53 +0000 (11:38 -0400)
committerJacobF <queatz@gmail.com>
Tue, 30 Aug 2011 15:38:53 +0000 (11:38 -0400)
src/content_nodemeta.cpp
src/inventory.cpp

index d29eea6616ec1361f6220be2b35f19af1d808975..e8f1e197e18dfc60161a7dbd626a953172258fa5 100644 (file)
@@ -293,7 +293,7 @@ bool FurnaceNodeMetadata::step(float dtime)
                        If there is no source item or source item is not cookable,
                        or furnace became overloaded, stop loop.
                */
-               if((m_fuel_time < m_fuel_totaltime || dst_list->roomForCookedItem(src_item) == false)
+               if((m_fuel_time < m_fuel_totaltime || (src_item && dst_list->roomForCookedItem(src_item) == false))
                        && (src_item == NULL || m_src_totaltime < 0.001))
                {
                        m_step_accumulator = 0;
index 62aedb536aee407b4309706c8b4b8c1b2c36c3aa..116ceeb6df3a838fb06c06ac4a817878d4625eef 100644 (file)
@@ -581,6 +581,8 @@ bool InventoryList::roomForItem(const InventoryItem *item)
 
 bool InventoryList::roomForCookedItem(const InventoryItem *item)
 {
+       if(!item)
+               return false;
        const InventoryItem *cook = item->createCookResult();
        if(!cook)
                return false;