TW-1678: segfault in ~ViewTask()
- Column::setStyle now validates column styles. - Thanks to Daniel Shahaf.
This commit is contained in:
@@ -52,7 +52,7 @@ ColumnDue::~ColumnDue ()
|
||||
// Note that you can not determine which gets called first.
|
||||
void ColumnDue::setStyle (const std::string& value)
|
||||
{
|
||||
_style = value;
|
||||
Column::setStyle (value);
|
||||
|
||||
if (_style == "countdown" && _label == STRING_COLUMN_LABEL_DUE)
|
||||
_label = STRING_COLUMN_LABEL_COUNT;
|
||||
|
||||
@@ -247,6 +247,16 @@ void Column::renderHeader (
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Column::setStyle (const std::string& style)
|
||||
{
|
||||
if (style != "default" &&
|
||||
std::find (_styles.begin (), _styles.end (), style) == _styles.end ())
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, style);
|
||||
|
||||
_style = style;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Column::validate (std::string& input)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
std::vector <std::string> styles () const { return _styles; }
|
||||
std::vector <std::string> examples () const { return _examples; }
|
||||
|
||||
virtual void setStyle (const std::string& value) { _style = value; }
|
||||
virtual void setStyle (const std::string&);
|
||||
virtual void setLabel (const std::string& value) { _label = value; }
|
||||
virtual void setReport (const std::string& value) { _report = value; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user