From: JacobF Date: Tue, 30 Aug 2011 15:38:53 +0000 (-0400) Subject: If there was no source item in a furnace it would cause a segmentation fault. X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=6415528f968f950cb6b4d6139e336f60a0260515;p=zefram%2Fminetest%2Fminetest_engine.git If there was no source item in a furnace it would cause a segmentation fault. --- diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp index d29eea66..e8f1e197 100644 --- a/src/content_nodemeta.cpp +++ b/src/content_nodemeta.cpp @@ -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; diff --git a/src/inventory.cpp b/src/inventory.cpp index 62aedb53..116ceeb6 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -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;