fixed NULL dereference.
This commit is contained in:
parent
4968a5bb7c
commit
0cbd6b07a2
|
@ -44,7 +44,7 @@ CClient::~CClient()
|
||||||
|
|
||||||
void CClient::run(const CNetworkAddress& serverAddress)
|
void CClient::run(const CNetworkAddress& serverAddress)
|
||||||
{
|
{
|
||||||
CThread* thread;
|
CThread* thread = NULL;
|
||||||
try {
|
try {
|
||||||
log((CLOG_NOTE "starting client"));
|
log((CLOG_NOTE "starting client"));
|
||||||
|
|
||||||
|
@ -70,18 +70,22 @@ void CClient::run(const CNetworkAddress& serverAddress)
|
||||||
log((CLOG_ERR "client error: %s", e.what()));
|
log((CLOG_ERR "client error: %s", e.what()));
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
|
if (thread != NULL) {
|
||||||
thread->cancel();
|
thread->cancel();
|
||||||
thread->wait();
|
thread->wait();
|
||||||
delete thread;
|
delete thread;
|
||||||
|
}
|
||||||
closeSecondaryScreen();
|
closeSecondaryScreen();
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
log((CLOG_DEBUG "unknown client error"));
|
log((CLOG_DEBUG "unknown client error"));
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
|
if (thread != NULL) {
|
||||||
thread->cancel();
|
thread->cancel();
|
||||||
thread->wait();
|
thread->wait();
|
||||||
delete thread;
|
delete thread;
|
||||||
|
}
|
||||||
closeSecondaryScreen();
|
closeSecondaryScreen();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue