[EU-FOSSA] Add an enhancement to prevent from the eventual crash.

This commit is contained in:
Don HO 2019-03-22 20:08:31 +01:00
parent 63d3a42c64
commit 4d58027f17
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -218,7 +218,6 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
{ {
if (!PathFileExists(longFileName) && !globbing) if (!PathFileExists(longFileName) && !globbing)
{ {
TCHAR str2display[MAX_PATH*2];
generic_string longFileDir(longFileName); generic_string longFileDir(longFileName);
PathRemoveFileSpec(longFileDir); PathRemoveFileSpec(longFileDir);
@ -254,8 +253,12 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
} }
else else
{ {
wsprintf(str2display, TEXT("\"%s\" cannot be opened:\nFolder \"%s\" doesn't exist."), longFileName, longFileDir.c_str()); generic_string str2display = TEXT("\"");
::MessageBox(_pPublicInterface->getHSelf(), str2display, TEXT("Cannot open file"), MB_OK); str2display += longFileName;
str2display += TEXT("\" cannot be opened:\nFolder \"");
str2display += longFileDir;
str2display += TEXT("\" doesn't exist.");
::MessageBox(_pPublicInterface->getHSelf(), str2display.c_str(), TEXT("Cannot open file"), MB_OK);
} }
if (!isCreateFileSuccessful) if (!isCreateFileSuccessful)