Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

NPE in @EIntentService.onHandleIntent #1499

Copy link
Copy link
@simonz

Description

@simonz
Issue body actions

NullPointerException was often occurred in @EIntentService.onHandleIntent
This is the generated @EIntentService code,

    @Override
    public void onHandleIntent(Intent intent) {
        MyIntentService_.super.onHandleIntent(intent);
        String action = intent.getAction();
        if (ACTION_EXECUTE.equals(action)) {
            // ....
        }   

sometimes intent gets null, so intent.getAction() makes NPE.
And I could find the documentation from http://developer.android.com/reference/android/app/IntentService.html#onStartCommand(android.content.Intent,%20int,%20int)

The Intent supplied to startService(Intent), as given. This may be null if the service is being restarted after its process has gone away, and it had previously returned anything except START_STICKY_COMPATIBILITY.

I think it is safe to check whether intent is null.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.