From 43d4a3a21ccb01335662ecf35bc8e59c045f4169 Mon Sep 17 00:00:00 2001 From: Kay-Uwe Janssen Date: Wed, 14 Jun 2017 17:43:21 +0200 Subject: [PATCH] Ignore null-Intents in EIntentService classes --- .../org/androidannotations/holder/EIntentServiceHolder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/holder/EIntentServiceHolder.java b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/holder/EIntentServiceHolder.java index cc13302987..77722e665d 100644 --- a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/holder/EIntentServiceHolder.java +++ b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/holder/EIntentServiceHolder.java @@ -1,5 +1,6 @@ /** * Copyright (C) 2010-2016 eBusiness Information, Excilys Group + * Copyright (C) 2016-2017 the AndroidAnnotations project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -15,6 +16,7 @@ */ package org.androidannotations.holder; +import static com.helger.jcodemodel.JExpr._null; import static com.helger.jcodemodel.JMod.PUBLIC; import javax.lang.model.element.TypeElement; @@ -73,6 +75,9 @@ private void createOnHandleIntent() { onHandleIntentMethod.annotate(Override.class); onHandleIntentBody = onHandleIntentMethod.body(); codeModelHelper.callSuperMethod(onHandleIntentMethod, this, onHandleIntentBody); + + onHandleIntentBody._if(onHandleIntentIntent.eq(_null()))._then()._return(); + JInvocation getActionInvocation = JExpr.invoke(onHandleIntentIntent, "getAction"); onHandleIntentIntentAction = onHandleIntentBody.decl(getClasses().STRING, "action", getActionInvocation); }