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: I3e17211c03bc74426bf5e2e414ec322d73b0060b
This commit is contained in:
parent
2e64ca57b8
commit
c7e1877d1c
1 changed files with 2 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue