diff --git a/src/main/java/org/sadtech/autoresponder/Autoresponder.java b/src/main/java/org/sadtech/autoresponder/Autoresponder.java index 80b104f..a269541 100644 --- a/src/main/java/org/sadtech/autoresponder/Autoresponder.java +++ b/src/main/java/org/sadtech/autoresponder/Autoresponder.java @@ -53,7 +53,7 @@ public class Autoresponder { } catch (NotFoundUnitException e) { unit = defaultUnit; } - return unit; + return Optional.ofNullable(unit).orElseThrow(NotFoundUnitException::new); } private Unit nextUnit(Set nextUnits, String message) {