fix nullpointer exception check date garden schedule

This commit is contained in:
giavaphi 2022-11-28 12:38:29 +01:00
parent 2452e42b72
commit ec42a6e75a
1 changed files with 8 additions and 6 deletions

View File

@ -147,12 +147,14 @@ public class GardenSchedule {
final int finalI = i;
weekTasks.forEach(task -> {
LocalDate checkDate = task.getNextExecution();
if (checkDate != null) {
do {
if (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN))) {
dayTaskList.get(finalI).add(task);
}
checkDate = checkDate.plusDays(task.getInterval().orElse(0));
} while (!(task.getInterval().orElse(0) == 0) && checkDate.isBefore(LocalDate.now().plusDays(listLength)));
}
});
}
return dayTaskList;