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); {
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()) {
} 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