fixed NULL dereference.

This commit is contained in:
crs 2002-05-22 16:42:48 +00:00
parent 4968a5bb7c
commit 0cbd6b07a2
1 changed files with 11 additions and 7 deletions

View File

@ -44,7 +44,7 @@ CClient::~CClient()
void CClient::run(const CNetworkAddress& serverAddress)
{
CThread* thread;
CThread* thread = NULL;
try {
log((CLOG_NOTE "starting client"));
@ -70,18 +70,22 @@ void CClient::run(const CNetworkAddress& serverAddress)
log((CLOG_ERR "client error: %s", e.what()));
// clean up
if (thread != NULL) {
thread->cancel();
thread->wait();
delete thread;
}
closeSecondaryScreen();
}
catch (...) {
log((CLOG_DEBUG "unknown client error"));
// clean up
if (thread != NULL) {
thread->cancel();
thread->wait();
delete thread;
}
closeSecondaryScreen();
throw;
}