Crash-Test-Buddies / WiFi-Buddy

Wi-Fi Buddy - Library to handle Android Wi-Fi Direct
https://groups.google.com/forum/#!forum/wi-fi-direct
MIT License
48 stars 12 forks source link

NullPointerException when attempting to connect to peer. #184

Open wtesler opened 7 years ago

wtesler commented 7 years ago
10-17 21:49:58.732  6664  6686 E Unity   : AndroidJavaException: **java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.wifi.p2p.WifiP2pDevice edu.rit.se.wifibuddy.DnsSdService.getSrcDevice()' on a null object reference
10-17 21:49:58.732  6664  6686 E Unity   : java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.wifi.p2p.WifiP2pDevice edu.rit.se.wifibuddy.DnsSdService.getSrcDevice()' on a null object reference
10-17 21:49:58.732  6664  6686 E Unity   :  at edu.rit.se.wifibuddy.WifiDirectHandler.initiateConnectToService(WifiDirectHandler.java:583)**
10-17 21:49:58.732  6664  6686 E Unity   :  at com.gmail.jeffersonlee2000.unitywifidirect.UnityWifiDirect.connectToService(UnityWifiDirect.java:82)

I'm using a Unity3D wrapper, but the NPE is in Java code. This error prevents the connection from being established.

The source of the error comes from this file, where getDnsSdServiceMap is not returning any Service.

Can anyone spot where the error is in the above implementation?