From ba41411805adde5f77873378fcf184e53bc869c3 Mon Sep 17 00:00:00 2001 From: Pavel Shliak Date: Fri, 5 Jun 2026 19:06:59 +0400 Subject: [PATCH] Handle empty lines in spellchecker files --- feathernotes/spellChecker.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/feathernotes/spellChecker.cpp b/feathernotes/spellChecker.cpp index ba9c77c..abf91ab 100644 --- a/feathernotes/spellChecker.cpp +++ b/feathernotes/spellChecker.cpp @@ -43,7 +43,8 @@ SpellChecker::SpellChecker (const QString& dictionaryPath, const QString& userDi QTextStream stream (&_affixFile); QRegularExpression encDetector ("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", QRegularExpression::CaseInsensitiveOption); QRegularExpressionMatch match; - for (QString line = stream.readLine(); !line.isEmpty(); line = stream.readLine()) + QString line; + while (stream.readLineInto (&line)) { if (line.indexOf (encDetector, 0, &match) > -1) { @@ -67,8 +68,12 @@ SpellChecker::SpellChecker (const QString& dictionaryPath, const QString& userDi if (userDictonaryFile.open (QIODevice::ReadOnly)) { QTextStream stream (&userDictonaryFile); - for (QString word = stream.readLine(); !word.isEmpty(); word = stream.readLine()) - ignoreWord (word); + QString word; + while (stream.readLineInto (&word)) + { + if (!word.isEmpty()) + ignoreWord (word); + } userDictonaryFile.close(); } }