Skip to content

Commit 43d4a3a

Browse files
committed
Ignore null-Intents in EIntentService classes
1 parent aab0cb7 commit 43d4a3a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/holder

‎AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/holder/EIntentServiceHolder.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Copyright (C) 2010-2016 eBusiness Information, Excilys Group
3+
* Copyright (C) 2016-2017 the AndroidAnnotations project
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
56
* use this file except in compliance with the License. You may obtain a copy of
@@ -15,6 +16,7 @@
1516
*/
1617
package org.androidannotations.holder;
1718

19+
import static com.helger.jcodemodel.JExpr._null;
1820
import static com.helger.jcodemodel.JMod.PUBLIC;
1921

2022
import javax.lang.model.element.TypeElement;
@@ -73,6 +75,9 @@ private void createOnHandleIntent() {
7375
onHandleIntentMethod.annotate(Override.class);
7476
onHandleIntentBody = onHandleIntentMethod.body();
7577
codeModelHelper.callSuperMethod(onHandleIntentMethod, this, onHandleIntentBody);
78+
79+
onHandleIntentBody._if(onHandleIntentIntent.eq(_null()))._then()._return();
80+
7681
JInvocation getActionInvocation = JExpr.invoke(onHandleIntentIntent, "getAction");
7782
onHandleIntentIntentAction = onHandleIntentBody.decl(getClasses().STRING, "action", getActionInvocation);
7883
}

0 commit comments

Comments
 (0)