aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-10-16 18:50:30 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-10-16 18:50:30 +0300
commit96b2d1fd298d54eed84061645a22b49fbc0f3051 (patch)
treea9383f2135290abfbcf11364c8ce02830e41e508
parent369177aa8015d75f4cb18c65f435efc1f2a9e05a (diff)
downloadminetest-96b2d1fd298d54eed84061645a22b49fbc0f3051.tar.gz
minetest-96b2d1fd298d54eed84061645a22b49fbc0f3051.tar.bz2
minetest-96b2d1fd298d54eed84061645a22b49fbc0f3051.zip
Check NULL pointer properly in some new code trying to log new stuff
-rw-r--r--src/server.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index a4b6fe649..33c3b59b3 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3045,8 +3045,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
player->inventory.getList("craftresult");
assert(list);
InventoryItem *item = list->getItem(0);
+ std::string itemname = "NULL";
+ if(item)
+ itemname = item->getName();
actionstream<<player->getName()<<" crafts "
- <<item->getName()<<std::endl;
+ <<itemname<<std::endl;
}
/*
If the craftresult is placed on itself, move it to