From 00b15ca4075cf9c6ed8c7b762188e344b8a95452 Mon Sep 17 00:00:00 2001 From: Wilhelm Schuermann Date: Sat, 15 Nov 2014 16:37:15 +0100 Subject: [PATCH] TW-1460 - Display error for empty due: attribute when adding recurring tasks. - Prevent endless loop for tasks that have an empty due: attribute. --- src/Task.cpp | 2 +- src/recur.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Task.cpp b/src/Task.cpp index 8121d7a72..341d49e09 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -1451,7 +1451,7 @@ void Task::validate (bool applyDefault /* = true */) throw std::string (STRING_TASK_VALID_BLANK); // Cannot have a recur frequency with no due date - when would it recur? - if (! has ("due") && has ("recur")) + if (has ("recur") && (! has ("due") || get ("due") == "")) throw std::string (STRING_TASK_VALID_REC_DUE); // Recur durations must be valid. diff --git a/src/recur.cpp b/src/recur.cpp index 18df1cdf6..bc3dd520d 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -159,6 +159,10 @@ bool generateDueDates (Task& parent, std::vector & allDue) { // Determine due date, recur period and until date. Date due (parent.get_date ("due")); + if (due == 0) + { + return false; + } std::string recur = parent.get ("recur"); bool specificEnd = false;