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

Commit b2f183cd authored by Treehugger Robot's avatar Treehugger Robot Committed by Chalard Jean
Browse files

Fix a stupid NPE

Okay so this is really not a behavior change as it converts an
NPE into an illegal argument exception, but still, that's what
should happen (and that's what the upcoming test actually tests
for).

Test: upcoming NetworkAgentTest
Bug: 139268426
Change-Id: I0d9b8cb8f8dcb587b9430b486b863efb9e9e77ef
Merged-In: I3e17211c03bc74426bf5e2e414ec322d73b0060b
(cherry picked from commit 827d7cee, aosp/1277595)
parent b02f8ff7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -556,12 +556,12 @@ public abstract class NetworkAgent {
    @NonNull
    public Network register() {
        if (VDBG) log("Registering NetworkAgent");
        final ConnectivityManager cm = (ConnectivityManager) mInitialConfiguration.context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        synchronized (mRegisterLock) {
            if (mNetwork != null) {
                throw new IllegalStateException("Agent already registered");
            }
            final ConnectivityManager cm = (ConnectivityManager) mInitialConfiguration.context
                    .getSystemService(Context.CONNECTIVITY_SERVICE);
            mNetwork = cm.registerNetworkAgent(new Messenger(mHandler),
                    new NetworkInfo(mInitialConfiguration.info),
                    mInitialConfiguration.properties, mInitialConfiguration.capabilities,