diff --git a/pom.xml b/pom.xml index 9338003..fc3c0a5 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,7 @@ org.apache.maven.plugins maven-compiler-plugin + 3.8.0 8 8 @@ -32,7 +33,7 @@ org.projectlombok lombok - ${lombok.ver} + 1.18.4 diff --git a/src/main/java/org/sadtech/autoresponder/Autoresponder.java b/src/main/java/org/sadtech/autoresponder/Autoresponder.java index 566a75a..3723185 100644 --- a/src/main/java/org/sadtech/autoresponder/Autoresponder.java +++ b/src/main/java/org/sadtech/autoresponder/Autoresponder.java @@ -29,15 +29,16 @@ public class Autoresponder { Unit unit; if (person.getUnit() == null) { unit = nextUnit(unitService.menuUnit(), message); - person.setUnit(unit); } else { - unit = nextUnit(person.getUnit().getNextUnits(), message); - if (unit == null) { - return null; + if (person.getUnit().getNextUnits() != null) { + unit = nextUnit(person.getUnit().getNextUnits(), message); } else { - person.setUnit(unit); + unit = nextUnit(unitService.menuUnit(), message); } } + if (unit!=null) { + person.setUnit(unit); + } return unit; }