diff options
Diffstat (limited to '')
-rw-r--r-- | src/exception.cpp | 13 |
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 | ||
4 | Exception::Exception( const char *lpFormat, ... ) throw() : | 4 | Exception::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 | ||
14 | Exception::Exception( int nCode, const char *lpFormat, ... ) throw() : | 15 | Exception::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 | ||
30 | Exception::~Exception() throw() | 32 | Exception::~Exception() throw() |
31 | { | 33 | { |
32 | delete[] sWhat; | 34 | if( sWhat ) |
35 | { | ||
36 | delete[] sWhat; | ||
37 | sWhat = NULL; | ||
38 | } | ||
33 | } | 39 | } |
34 | 40 | ||
35 | void Exception::setWhat( const char *lpFormat, va_list &vargs ) | 41 | void 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 ); |