fix nullpointer exception check date garden schedule
This commit is contained in:
parent
2452e42b72
commit
ec42a6e75a
|
@ -147,12 +147,14 @@ public class GardenSchedule {
|
||||||
final int finalI = i;
|
final int finalI = i;
|
||||||
weekTasks.forEach(task -> {
|
weekTasks.forEach(task -> {
|
||||||
LocalDate checkDate = task.getNextExecution();
|
LocalDate checkDate = task.getNextExecution();
|
||||||
|
if (checkDate != null) {
|
||||||
do {
|
do {
|
||||||
if (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN))) {
|
if (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN))) {
|
||||||
dayTaskList.get(finalI).add(task);
|
dayTaskList.get(finalI).add(task);
|
||||||
}
|
}
|
||||||
checkDate = checkDate.plusDays(task.getInterval().orElse(0));
|
checkDate = checkDate.plusDays(task.getInterval().orElse(0));
|
||||||
} while (!(task.getInterval().orElse(0) == 0) && checkDate.isBefore(LocalDate.now().plusDays(listLength)));
|
} while (!(task.getInterval().orElse(0) == 0) && checkDate.isBefore(LocalDate.now().plusDays(listLength)));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return dayTaskList;
|
return dayTaskList;
|
||||||
|
|
Loading…
Reference in New Issue