TW-1666: import should reject invalid data

- Thanks to Daniel Shahaf.
This commit is contained in:
Paul Beckingham
2015-08-22 12:34:10 -04:00
parent d640fed3d4
commit bc1aa0bc0f
11 changed files with 14 additions and 2 deletions

View File

@@ -178,7 +178,7 @@ Task::status Task::textToStatus (const std::string& input)
else if (input[0] == 'r') return Task::recurring;
else if (input[0] == 'w') return Task::waiting;
return Task::pending;
throw format (STRING_ERROR_BAD_STATUS, input);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1401,7 +1401,9 @@ void Task::substitute (
//
void Task::validate (bool applyDefault /* = true */)
{
Task::status status = getStatus ();
Task::status status = Task::pending;
if (get ("status") != "")
status = getStatus ();
// 1) Provide missing attributes where possible
// Provide a UUID if necessary. Validate if present.