From 9d89c12a38dc918b2d11cbeb03b5680282576b30 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 6 Apr 2009 18:57:30 +0000 Subject: [PATCH] added NULL gard in dhtPublish() git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1116 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/dht/opendhtmgr.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/dht/opendhtmgr.cc b/libretroshare/src/dht/opendhtmgr.cc index fe27731a2..13acdfa4e 100644 --- a/libretroshare/src/dht/opendhtmgr.cc +++ b/libretroshare/src/dht/opendhtmgr.cc @@ -51,14 +51,19 @@ class dhtPublishData extern "C" void* doDhtPublish(void* p) { +#ifdef OPENDHT_DEBUG + std::cerr << "in doDhtPublish(void* p)" << std::endl ; +#endif dhtPublishData *data = (dhtPublishData *) p; - if ((!data) || (!data->mgr) || (!data->client)) + if(data == NULL) { pthread_exit(NULL); + return NULL; } /* publish it! */ - data->client->publishKey(data->key, data->value, data->ttl); + if(data->mgr != NULL && data->client != NULL) + data->client->publishKey(data->key, data->value, data->ttl); delete data; pthread_exit(NULL); @@ -170,6 +175,10 @@ bool OpenDHTMgr::publishDHT(std::string key, std::string value, uint32_t ttl) /* launch a publishThread */ pthread_t tid; +#ifdef OPENDHT_DEBUG + std::cerr << "in publishDHT(.......)" << std::endl ; +#endif + dhtPublishData *pub = new dhtPublishData; pub->mgr = this; pub->client = mClient;