Fix file reading failure (network problem) not detected issue

The current bug: the unconnected network or USB drive while loading a file from it is not detected. As a result Notepad++ opens an empty or uncomplete document.
This commit fix it by not opening anything and showing error box, if file reading fails.

Fix #3381, close #8267
This commit is contained in:
dimon4eg 2020-05-14 18:37:25 +03:00 committed by Don HO
parent 4003d6d923
commit a42c1674e9
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
1 changed files with 5 additions and 0 deletions

View File

@ -1351,6 +1351,11 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
do
{
lenFile = fread(data+incompleteMultibyteChar, 1, blockSize-incompleteMultibyteChar, fp) + incompleteMultibyteChar;
if (ferror(fp) != 0)
{
success = false;
break;
}
if (lenFile == 0) break;
if (isFirstTime)