mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 11:08:31 +00:00
Fix NPE in wifi direct connection establishment.
This commit is contained in:
@@ -357,8 +357,11 @@ final class DeviceTransferClient implements Handler.Callback {
|
|||||||
public void onNetworkConnected(@NonNull WifiP2pInfo info) {
|
public void onNetworkConnected(@NonNull WifiP2pInfo info) {
|
||||||
if (info.isGroupOwner) {
|
if (info.isGroupOwner) {
|
||||||
handler.sendEmptyMessage(START_IP_EXCHANGE);
|
handler.sendEmptyMessage(START_IP_EXCHANGE);
|
||||||
} else {
|
} else if (info.groupOwnerAddress != null) {
|
||||||
handler.sendMessage(handler.obtainMessage(START_NETWORK_CLIENT, info.groupOwnerAddress.getHostAddress()));
|
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();
|
ensureInitialized();
|
||||||
|
|
||||||
manager.requestConnectionInfo(channel, info -> {
|
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;
|
WifiDirectConnectionListener listener = connectionListener;
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onNetworkConnected(info);
|
listener.onNetworkConnected(info);
|
||||||
|
|||||||
Reference in New Issue
Block a user