Skip to content

Commit f9c0105

Browse files
committed
Add a check on idsRefs of AbstractListenerProcessor to get ride of NPE if resources id doesn't exists
1 parent c62b8de commit f9c0105

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/AbstractListenerProcessor.java‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
8080
processParameters(listenerMethod, call, parameters);
8181

8282
for (JFieldRef idRef : idsRefs) {
83-
ViewChangedHolder onViewChanged = holder.onViewChanged();
83+
if (idRef != null) {
84+
ViewChangedHolder onViewChanged = holder.onViewChanged();
8485

85-
JBlock block = onViewChanged.body().block();
86-
JInvocation view = onViewChanged.findViewById(idRef);
87-
88-
block._if(view.ne(_null()))._then().invoke(castWidget(view), getSetterName()).arg(_new(listenerAnonymousClass));
86+
JBlock block = onViewChanged.body().block();
87+
JInvocation view = onViewChanged.findViewById(idRef);
88+
block._if(view.ne(_null()))._then().invoke(castWidget(view), getSetterName()).arg(_new(listenerAnonymousClass));
89+
}
8990
}
9091
}
9192

0 commit comments

Comments
 (0)