Commit 2f357f08 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Avoid duplicating the last empty line when writing back lines

GnuPG-bug-id: 6096
parent 58c7ecce
......@@ -252,6 +252,10 @@ QString change_trust_file(const QString &trustListFile, const QString &key, Key:
if (QFile::exists(trustListFile)) { // non-existence is not fatal...
if (QFile in(trustListFile); in.open(QIODevice::ReadOnly)) {
trustListFileContents = in.readAll().split('\n');
// remove last empty line to avoid adding more empty lines when we write the lines
if (!trustListFileContents.empty() && trustListFileContents.back().isEmpty()) {
trustListFileContents.pop_back();
}
} else { // ...but failure to open an existing file _is_
return i18n("Cannot open existing file \"%1\" for reading: %2",
trustListFile, in.errorString());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment