Skip to content

Commit 91c5bda

Browse files
committed
Merge pull request androidannotations#341 from pvardanega/develop
Fix NPE in FragmentByIdProcessor. Fixes androidannotations#281.
2 parents 76e91bc + c2eb7d5 commit 91c5bda

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎AndroidAnnotations/androidannotations/src/main/java/com/googlecode/androidannotations/processing/FragmentByIdProcessor.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import javax.annotation.processing.ProcessingEnvironment;
2727
import javax.lang.model.element.Element;
28+
import javax.lang.model.element.TypeElement;
2829
import javax.lang.model.type.TypeMirror;
2930

3031
import com.googlecode.androidannotations.annotations.FragmentById;
@@ -62,12 +63,11 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
6263
TypeMirror elementType = element.asType();
6364
String typeQualifiedName = elementType.toString();
6465

65-
TypeMirror nativeFragmentType = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.FRAGMENT).asType();
66+
TypeElement nativeFragmentElement = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.FRAGMENT);
6667

6768
JMethod findFragmentById;
68-
if (annotationHelper.isSubtype(elementType, nativeFragmentType)) {
69+
if (nativeFragmentElement != null && annotationHelper.isSubtype(elementType, nativeFragmentElement.asType())) {
6970
// Injecting native fragment
70-
7171
findFragmentById = null;
7272

7373
if (holder.findNativeFragmentById == null) {

0 commit comments

Comments
 (0)