added NULL gard in dhtPublish()

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1116 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-04-06 18:57:30 +00:00
parent 1542d5ad2c
commit 9d89c12a38

View File

@ -51,13 +51,18 @@ class dhtPublishData
extern "C" void* doDhtPublish(void* p) extern "C" void* doDhtPublish(void* p)
{ {
#ifdef OPENDHT_DEBUG
std::cerr << "in doDhtPublish(void* p)" << std::endl ;
#endif
dhtPublishData *data = (dhtPublishData *) p; dhtPublishData *data = (dhtPublishData *) p;
if ((!data) || (!data->mgr) || (!data->client)) if(data == NULL)
{ {
pthread_exit(NULL); pthread_exit(NULL);
return NULL;
} }
/* publish it! */ /* publish it! */
if(data->mgr != NULL && data->client != NULL)
data->client->publishKey(data->key, data->value, data->ttl); data->client->publishKey(data->key, data->value, data->ttl);
delete data; delete data;
@ -170,6 +175,10 @@ bool OpenDHTMgr::publishDHT(std::string key, std::string value, uint32_t ttl)
/* launch a publishThread */ /* launch a publishThread */
pthread_t tid; pthread_t tid;
#ifdef OPENDHT_DEBUG
std::cerr << "in publishDHT(.......)" << std::endl ;
#endif
dhtPublishData *pub = new dhtPublishData; dhtPublishData *pub = new dhtPublishData;
pub->mgr = this; pub->mgr = this;
pub->client = mClient; pub->client = mClient;