Fix a crash issue due to opening an empty .NFO file

There was an infinite recursion for such empty files, when the default setting for new files was UTF8.

Fixes #11820, close #11824
This commit is contained in:
xomx 2022-06-22 14:54:26 +02:00 committed by Don Ho
parent 2258274780
commit 9d69db9b15
1 changed files with 1 additions and 1 deletions

View File

@ -1601,7 +1601,7 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
fileFormat._eolFormat = ndds._format;
//for empty files, if the default for new files is UTF8, and "Apply to opened ANSI files" is set, apply it
if (fileSize == 0)
if ((fileSize == 0) && (fileFormat._encoding < 1))
{
if (ndds._unicodeMode == uniCookie && ndds._openAnsiAsUtf8)
fileFormat._encoding = SC_CP_UTF8;