Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ec8fc6c authored by Gabriele M's avatar Gabriele M
Browse files

Prevent NPE on A/B devices

The NPE shouldn't happen as we get a null intent only when the
service is sticky (i.e., isInstallingUpdate() is true), so this
is currently not a problem.

Change-Id: I8647498d9a1022f5c7207a2da3e42cf57d9ee030
parent a409a4a0
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -162,13 +162,15 @@ public class UpdaterService extends Service {
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.d(TAG, "Starting service");

        if ((intent == null || intent.getAction() == null) &&
                ABUpdateInstaller.isInstallingUpdate(this)) {
        if (intent == null || intent.getAction() == null) {
            if (ABUpdateInstaller.isInstallingUpdate(this)) {
                // The service is being restarted.
            ABUpdateInstaller installer = ABUpdateInstaller.getInstance(this, mUpdaterController);
                ABUpdateInstaller installer = ABUpdateInstaller.getInstance(this,
                        mUpdaterController);
                if (installer.reconnect()) {
                    return START_STICKY;
                }
            }
        } else if (ACTION_DOWNLOAD_CONTROL.equals(intent.getAction())) {
            String downloadId = intent.getStringExtra(EXTRA_DOWNLOAD_ID);
            int action = intent.getIntExtra(EXTRA_DOWNLOAD_CONTROL, -1);