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

Commit 5983dc14 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Fix potential NPE when querying remote connection services.

It is possible that one of the remote connection services has unbound
during the query process.  Ensure that if this happens we do not attempt
to access its now-null service interface.

Test: Manual
Fixes: 74196849
Merged-In: I5b41395eb1e49e8addfa0bb41d13b97862988e1d
Change-Id: I5b41395eb1e49e8addfa0bb41d13b97862988e1d
(cherry picked from commit 2f89c32f)
parent 69167413
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1602,8 +1602,16 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                @Override
                public void onSuccess() {
                    Log.d(this, "Adding simService %s", currentSimService.getComponentName());
                    if (currentSimService.mServiceInterface == null) {
                        // The remote ConnectionService died, so do not add it.
                        // We will still perform maybeComplete() and notify the caller with an empty
                        // list of sim services via maybeComplete().
                        Log.w(this, "queryRemoteConnectionServices: simService %s died - Skipping.",
                                currentSimService.getComponentName());
                    } else {
                        simServiceComponentNames.add(currentSimService.getComponentName());
                        simServiceBinders.add(currentSimService.mServiceInterface.asBinder());
                    }
                    maybeComplete();
                }