fix: avoid nullptr in generated code

This commit is contained in:
zaaarf 2024-08-30 12:20:46 +02:00
parent d6c1976261
commit 8027656386
No known key found for this signature in database
GPG key ID: 102E445F4C3F829B

View file

@ -215,9 +215,9 @@ public class GEBProcessor extends AbstractProcessor {
for(ListenerContainer listener : ordered) {
String varName = String.format("listener%d", done.get(listener.parent));
callListenersBuilder
.addStatement("for($T l : $L) {", this.listenerInterface, varName)
.addStatement("if($L != null) { for($T l : $L) {", varName, this.listenerInterface, varName)
.addStatement(
"if(l != null) (($T) l).$L(($T) $N); }",
"if(l != null) (($T) l).$L(($T) $N); } }",
listener.parent,
listener.method.getSimpleName().toString(),
event,