mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TW-1723: task info causes segfault
- Thanks to Roman Golovin. - Calls like 'context.columns[name]' autovivify the key 'name' with a default ctor value, which ends up polluting the context.columns map with every unique attribute name, which is a lot of 'annotation_nnnnnnnnnn' attributes.
This commit is contained in:
parent
fdda485032
commit
79189c448c
4 changed files with 37 additions and 31 deletions
|
@ -262,16 +262,19 @@ std::string taskInfoDifferences (
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string renderAttribute (const std::string& name, const std::string& value, const std::string& format /* = "" */)
|
||||
{
|
||||
Column* col = context.columns[name];
|
||||
if (col &&
|
||||
col->type () == "date" &&
|
||||
value != "")
|
||||
if (context.columns.find (name) != context.columns.end ())
|
||||
{
|
||||
ISO8601d d ((time_t)strtol (value.c_str (), NULL, 10));
|
||||
if (format == "")
|
||||
return d.toString (context.config.get ("dateformat"));
|
||||
Column* col = context.columns[name];
|
||||
if (col &&
|
||||
col->type () == "date" &&
|
||||
value != "")
|
||||
{
|
||||
ISO8601d d ((time_t)strtol (value.c_str (), NULL, 10));
|
||||
if (format == "")
|
||||
return d.toString (context.config.get ("dateformat"));
|
||||
|
||||
return d.toString (format);
|
||||
return d.toString (format);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue