From 0cbd6b07a28cb9bbe124aed308c0d0333919e197 Mon Sep 17 00:00:00 2001 From: crs Date: Wed, 22 May 2002 16:42:48 +0000 Subject: [PATCH] fixed NULL dereference. --- client/CClient.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/client/CClient.cpp b/client/CClient.cpp index d1ef18a6..3f0bdd40 100644 --- a/client/CClient.cpp +++ b/client/CClient.cpp @@ -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 - thread->cancel(); - thread->wait(); - delete thread; + if (thread != NULL) { + thread->cancel(); + thread->wait(); + delete thread; + } closeSecondaryScreen(); } catch (...) { log((CLOG_DEBUG "unknown client error")); // clean up - thread->cancel(); - thread->wait(); - delete thread; + if (thread != NULL) { + thread->cancel(); + thread->wait(); + delete thread; + } closeSecondaryScreen(); throw; }