diff --git a/ChangeLog b/ChangeLog index 989aef91e..8b982caf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ + Added feature #292 that permits alternate line coloration in reports (thanks to Richard Querin). + The 'delete' command is now aliased to 'rm' (thanks to Ivo Jimenez). + + Fixed bug that showed a calendar for the year 2037 when 'task calendar due' + was run, and there are no tasks with due dates. ------ old releases ------------------------------ diff --git a/src/report.cpp b/src/report.cpp index c63dc539d..084cd4806 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -1536,6 +1536,7 @@ int handleReportCalendar (std::string &outs) yFrom = atoi( context.args[2].data()); } + int countDueDates = 0; if (getpendingdate == true) { // Find the oldest pending due date. Date oldest (12,31,2037); @@ -1545,6 +1546,7 @@ int handleReportCalendar (std::string &outs) { if (task->has ("due")) { + ++countDueDates; Date d (atoi (task->get ("due").c_str ())); if (d < oldest) oldest = d; } @@ -1554,6 +1556,11 @@ int handleReportCalendar (std::string &outs) yFrom = oldest.year(); } + // If there are no tasks with due dates, then prevent showing a calendar from + // the year 2037. + if (countDueDates == 0) + throw std::string ("There are no tasks that have due dates."); + mTo = mFrom + monthsToDisplay - 1; yTo = yFrom; if (mTo > 12) {