aboutsummaryrefslogtreecommitdiff
path: root/src/exception.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/exception.cpp')
-rw-r--r--src/exception.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/exception.cpp b/src/exception.cpp
index 291a198..3cde134 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -2,7 +2,8 @@
2#include <stdarg.h> 2#include <stdarg.h>
3 3
4Exception::Exception( const char *lpFormat, ... ) throw() : 4Exception::Exception( const char *lpFormat, ... ) throw() :
5 nErrorCode( 0 ) 5 nErrorCode( 0 ),
6 sWhat( NULL )
6{ 7{
7 va_list ap; 8 va_list ap;
8 9
@@ -12,7 +13,8 @@ Exception::Exception( const char *lpFormat, ... ) throw() :
12} 13}
13 14
14Exception::Exception( int nCode, const char *lpFormat, ... ) throw() : 15Exception::Exception( int nCode, const char *lpFormat, ... ) throw() :
15 nErrorCode( nCode ) 16 nErrorCode( nCode ),
17 sWhat( NULL )
16{ 18{
17 va_list ap; 19 va_list ap;
18 20
@@ -29,11 +31,16 @@ Exception::Exception( int nCode ) throw() :
29 31
30Exception::~Exception() throw() 32Exception::~Exception() throw()
31{ 33{
32 delete[] sWhat; 34 if( sWhat )
35 {
36 delete[] sWhat;
37 sWhat = NULL;
38 }
33} 39}
34 40
35void Exception::setWhat( const char *lpFormat, va_list &vargs ) 41void Exception::setWhat( const char *lpFormat, va_list &vargs )
36{ 42{
43 if( sWhat ) delete[] sWhat;
37 int nSize; 44 int nSize;
38 45
39 nSize = vsnprintf( NULL, 0, lpFormat, vargs ); 46 nSize = vsnprintf( NULL, 0, lpFormat, vargs );