mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CmdConfig: Properly preserve comments at the end of the line
Trailing comments previously caused crash of the application. Closes #2581.
This commit is contained in:
parent
e2e184b8d4
commit
a464324617
1 changed files with 2 additions and 1 deletions
|
@ -80,8 +80,9 @@ bool CmdConfig::setConfigVariable (
|
|||
{
|
||||
auto new_line = line.substr (0, pos + name.length () + 1) + json::encode (value);
|
||||
|
||||
// Preserve the comment
|
||||
if (comment != std::string::npos)
|
||||
line += ' ' + line.substr (comment);
|
||||
new_line += " " + line.substr (comment);
|
||||
|
||||
// Rewrite the line
|
||||
line = new_line;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue