Add a null check for the OnStartTetheringCallback.
This avoids a NullPointerException when trying to call the callback and gives a more readable error message. Change-Id: Id0353ef541c76efcb4a9a12c082e1b6ec9389f02
This commit is contained in:
@@ -1987,6 +1987,8 @@ public class ConnectivityManager {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
public void startTethering(int type, boolean showProvisioningUi,
|
public void startTethering(int type, boolean showProvisioningUi,
|
||||||
final OnStartTetheringCallback callback, Handler handler) {
|
final OnStartTetheringCallback callback, Handler handler) {
|
||||||
|
checkNotNull(callback, "OnStartTetheringCallback cannot be null.");
|
||||||
|
|
||||||
ResultReceiver wrappedCallback = new ResultReceiver(handler) {
|
ResultReceiver wrappedCallback = new ResultReceiver(handler) {
|
||||||
@Override
|
@Override
|
||||||
protected void onReceiveResult(int resultCode, Bundle resultData) {
|
protected void onReceiveResult(int resultCode, Bundle resultData) {
|
||||||
@@ -1997,6 +1999,7 @@ public class ConnectivityManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mService.startTethering(type, wrappedCallback, showProvisioningUi);
|
mService.startTethering(type, wrappedCallback, showProvisioningUi);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user