Check NULL pointer while opening filees to prevent Notepad++ from crash

Fix #14131, close #14094
This commit is contained in:
Dmitry 2023-09-17 11:29:49 -07:00 committed by Don Ho
parent 670e2f098d
commit cb1f2d1479
1 changed files with 2 additions and 0 deletions

View File

@ -59,6 +59,8 @@ std::string getFileContent(const TCHAR *file2read)
char data[blockSize]; char data[blockSize];
std::string wholeFileContent = ""; std::string wholeFileContent = "";
FILE *fp = _wfopen(file2read, TEXT("rb")); FILE *fp = _wfopen(file2read, TEXT("rb"));
if (!fp)
return "";
size_t lenFile = 0; size_t lenFile = 0;
do do