Merge pull request #73 from schrom01/feature_guiOverhaul_M3
fix nullpointer exception check date garden schedule
This commit is contained in:
commit
e9fbbf2f9f
|
@ -146,8 +146,11 @@ public class GardenSchedule {
|
||||||
dayTaskList.add(new ArrayList<>());
|
dayTaskList.add(new ArrayList<>());
|
||||||
final int finalI = i;
|
final int finalI = i;
|
||||||
weekTasks.forEach(task -> {
|
weekTasks.forEach(task -> {
|
||||||
LocalDate checkDate = task.getNextExecution();
|
if (task.getNextExecution() == null) {
|
||||||
if (checkDate != null) {
|
task.isDone();
|
||||||
|
} else {
|
||||||
|
LocalDate checkDate = task.getNextExecution();
|
||||||
|
|
||||||
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);
|
||||||
|
@ -189,6 +192,6 @@ public class GardenSchedule {
|
||||||
* @return a sorted coppy of the given Tasklist
|
* @return a sorted coppy of the given Tasklist
|
||||||
*/
|
*/
|
||||||
private List<Task> getSortedTaskList(List<Task> taskList, Comparator<Task> comparator) {
|
private List<Task> getSortedTaskList(List<Task> taskList, Comparator<Task> comparator) {
|
||||||
return taskList.stream().sorted(comparator).collect(Collectors.toList());
|
return taskList.stream().filter(task -> task.getNextExecution() != null).sorted(comparator).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue