From 9d69db9b1540500bf360383c2e5b28da67ebcf68 Mon Sep 17 00:00:00 2001 From: xomx Date: Wed, 22 Jun 2022 14:54:26 +0200 Subject: [PATCH] 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 --- PowerEditor/src/ScintillaComponent/Buffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index be2499086..1a006fa51 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -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;