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:
Paul Beckingham 2015-11-15 12:57:26 -05:00
parent fdda485032
commit 79189c448c
4 changed files with 37 additions and 31 deletions

View file

@ -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;