From 7b2e68d17639ecde198b38a7dd7e2332d7eb2511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Date: Fri, 21 Feb 2020 17:32:49 +0100 Subject: [PATCH] Fix parsing of "PnM" recurrence periods Due to not accounting for the leading "P", getNextRecurrence would always return the same datetime, breaking all generic "PnM" periods and leading to an infinite loop in generateDueDates. --- src/recur.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recur.cpp b/src/recur.cpp index 3181bed3d..f82e7600a 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -251,7 +251,7 @@ Datetime getNextRecurrence (Datetime& current, std::string& period) Lexer::isAllDigits (period.substr (1, period.length () - 2)) && period[period.length () - 1] == 'M') { - int increment = strtol (period.substr (0, period.length () - 1).c_str (), nullptr, 10); + int increment = strtol (period.substr (1, period.length () - 2).c_str (), nullptr, 10); m += increment; while (m > 12)