Task
- When a duration fails to parse during ::modify, it must raise an exception, and not silently skip the attribute.
This commit is contained in:
31
src/Task.cpp
31
src/Task.cpp
@@ -2034,25 +2034,22 @@ void Task::modify (modType type, bool text_required /* = false */)
|
|||||||
{
|
{
|
||||||
// The duration is stored in raw form, but it must still be valid,
|
// The duration is stored in raw form, but it must still be valid,
|
||||||
// and therefore is parsed first.
|
// and therefore is parsed first.
|
||||||
try
|
Eval e;
|
||||||
|
e.addSource (domSource);
|
||||||
|
e.addSource (namedDates);
|
||||||
|
e.ambiguity (false);
|
||||||
|
contextTask = *this;
|
||||||
|
|
||||||
|
Variant v;
|
||||||
|
e.evaluateInfixExpression (value, v);
|
||||||
|
if (v.type () == Variant::type_duration)
|
||||||
{
|
{
|
||||||
Eval e;
|
// Store the raw value, for 'recur'.
|
||||||
e.addSource (domSource);
|
set (name, value);
|
||||||
e.addSource (namedDates);
|
++modCount;
|
||||||
e.ambiguity (false);
|
|
||||||
contextTask = *this;
|
|
||||||
|
|
||||||
Variant v;
|
|
||||||
e.evaluateInfixExpression (value, v);
|
|
||||||
if (v.type () == Variant::type_duration)
|
|
||||||
{
|
|
||||||
// Store the raw value, for 'recur'.
|
|
||||||
set (name, value);
|
|
||||||
++modCount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
catch (...) { /* NOP */ }
|
throw format ("The duration value '{1}' is not supported.", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need handling for numeric types, used by UDAs.
|
// Need handling for numeric types, used by UDAs.
|
||||||
|
|||||||
Reference in New Issue
Block a user