Skip to content

Commit

Permalink
Don't crash if no .imm files are found
Browse files Browse the repository at this point in the history
  • Loading branch information
smowton committed Feb 8, 2016
1 parent 14f436e commit 3927143
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/increadimail_convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ typedef enum INCREDIMAIL_VERSIONS {
INCREDIMAIL_2,
};

extern HWND global_hwnd;

void email_count( char *, int *, int * );
//***************************************************************************
// INPUTS:
Expand Down
4 changes: 4 additions & 0 deletions Source/incredimail_convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ int total_count = 1;
list_output = CreateFile(temp_filename, GENERIC_WRITE, 0x0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );

hFind = FindFirstFile(database_filename, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
MessageBox(global_hwnd, "No .imm files found within given directory", "Error!", MB_OK);
return -1;
}

sprintf(temp_string, "%s\\%s%c%c", directory_search, FindFileData.cFileName, 0x0D, 0x0A );
WriteFile( list_output, temp_string, (DWORD) strlen( temp_string ), &dummy, NULL );
Expand Down
2 changes: 2 additions & 0 deletions Source/winmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ enum INCREDIMAIL_VERSION incredimail_version;
} else {

total_count = FindDatabaseFiles( im_database_filename, temp_file_listing );
if (total_count < 0)
return;

// set the progress bar 2
SendDlgItemMessage( global_hwnd, IDC_PROGRESS2, PBM_SETRANGE, 0, (LPARAM) MAKELPARAM (0, total_count));
Expand Down

0 comments on commit 3927143

Please sign in to comment.