diff --git a/radiant/missing.cpp b/radiant/missing.cpp index 0245ec1e..f83bed3c 100644 --- a/radiant/missing.cpp +++ b/radiant/missing.cpp @@ -149,6 +149,7 @@ FindFiles::FindFiles( const char *_directory ) { FindFiles::~FindFiles() { if ( findHandle != NULL ) { closedir( findHandle ); + findHandle = NULL; } } @@ -173,8 +174,9 @@ FindFiles::FindFiles( const char *_directory ) { } FindFiles::~FindFiles() { - if ( findHandle != NULL ) { + if ( findHandle != INVALID_HANDLE_VALUE ) { FindClose( findHandle ); + findHandle = INVALID_HANDLE_VALUE; } } @@ -188,6 +190,7 @@ const char* FindFiles::NextFile() { } if ( FindNextFile( findHandle, &findFileData ) == 0 ) { FindClose( findHandle ); + findHandle = INVALID_HANDLE_VALUE; return NULL; } return findFileData.cFileName;