Add a null check for the OnStartTetheringCallback.
This avoids a NullPointerException when trying to call the callback
and gives a more readable error message.
(cherry picked from commit 49a5795ef0)
Change-Id: Ia419ff68ef10f308f9e44be47420e27099ee6070
This commit is contained in:
parent
db884dbcf4
commit
8a66b4cda9
1 changed files with 3 additions and 0 deletions
|
|
@ -2079,6 +2079,8 @@ public class ConnectivityManager {
|
|||
@SystemApi
|
||||
public void startTethering(int type, boolean showProvisioningUi,
|
||||
final OnStartTetheringCallback callback, Handler handler) {
|
||||
checkNotNull(callback, "OnStartTetheringCallback cannot be null.");
|
||||
|
||||
ResultReceiver wrappedCallback = new ResultReceiver(handler) {
|
||||
@Override
|
||||
protected void onReceiveResult(int resultCode, Bundle resultData) {
|
||||
|
|
@ -2089,6 +2091,7 @@ public class ConnectivityManager {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
mService.startTethering(type, wrappedCallback, showProvisioningUi);
|
||||
} catch (RemoteException e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue