Skip to content

Commit a9a0705

Browse files
committed
handle null
1 parent dbf4a5a commit a9a0705

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

http-generator-core/src/main/java/io/avaje/http/generator/core/ControllerReader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ private List<Element> initInterfaces() {
8484
List<Element> interfaces = new ArrayList<>();
8585
for (TypeMirror anInterface : beanType.getInterfaces()) {
8686
final Element ifaceElement = ctx.asElement(anInterface);
87-
if (!ifaceElement.getAnnotation(Controller.class).value().isBlank()
87+
var controller = ifaceElement.getAnnotation(Controller.class);
88+
if (controller != null && !controller.value().isBlank()
8889
|| ifaceElement.getAnnotation(Path.class) != null) {
8990
interfaces.add(ifaceElement);
9091
}
@@ -257,7 +258,7 @@ public List<MethodReader> methods() {
257258

258259
public String path() {
259260

260-
return Optional.of(findAnnotation(Controller.class))
261+
return Optional.ofNullable(findAnnotation(Controller.class))
261262
.map(Controller::value)
262263
.filter(not(String::isBlank))
263264
.or(() -> Optional.ofNullable(findAnnotation(Path.class)).map(Path::value))

0 commit comments

Comments
 (0)