Fix NPE in wifi direct connection establishment.
This commit is contained in:
parent
750825b3c3
commit
ae98d5e3bd
2 changed files with 5 additions and 2 deletions
|
@ -357,8 +357,11 @@ final class DeviceTransferClient implements Handler.Callback {
|
|||
public void onNetworkConnected(@NonNull WifiP2pInfo info) {
|
||||
if (info.isGroupOwner) {
|
||||
handler.sendEmptyMessage(START_IP_EXCHANGE);
|
||||
} else {
|
||||
} else if (info.groupOwnerAddress != null) {
|
||||
handler.sendMessage(handler.obtainMessage(START_NETWORK_CLIENT, info.groupOwnerAddress.getHostAddress()));
|
||||
} else {
|
||||
Log.d(TAG, "Group owner address null, re-requesting networking information.");
|
||||
handler.sendMessage(handler.obtainMessage(NETWORK_CONNECTION_CHANGED, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ public final class WifiDirect {
|
|||
ensureInitialized();
|
||||
|
||||
manager.requestConnectionInfo(channel, info -> {
|
||||
Log.i(TAG, "Connection information available. group_formed: " + info.groupFormed + " group_owner: " + info.isGroupOwner);
|
||||
Log.i(TAG, "Connection information available. group_formed: " + info.groupFormed + " is_group_owner: " + info.isGroupOwner + " has_group_owner_address: " + (info.groupOwnerAddress != null));
|
||||
WifiDirectConnectionListener listener = connectionListener;
|
||||
if (listener != null) {
|
||||
listener.onNetworkConnected(info);
|
||||
|
|
Loading…
Add table
Reference in a new issue