bparmentier / WiFiKeyShare

Share Wi-Fi passwords with QR codes or NFC tags
https://wifikeysha.re
GNU General Public License v3.0
118 stars 40 forks source link

NullPointerException in WifiNetwork.getSsidFromWifiConfiguration #14

Closed bparmentier closed 8 years ago

bparmentier commented 8 years ago

Seems like WifiNetwork.SSID can sometimes be null (WiFiKeyShare 1.1 on Samsung Galaxy S6):

E/AndroidRuntime( 8372): FATAL EXCEPTION: AsyncTask #1
E/AndroidRuntime( 8372): Process: be.brunoparmentier.wifikeyshare, PID: 8372
E/AndroidRuntime( 8372): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 8372):    at android.os.AsyncTask$3.done(AsyncTask.java:304)
E/AndroidRuntime( 8372):    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime( 8372):    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime( 8372):    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime( 8372):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/AndroidRuntime( 8372):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime( 8372):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime( 8372):    at java.lang.Thread.run(Thread.java:818)
E/AndroidRuntime( 8372): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference
E/AndroidRuntime( 8372):    at be.brunoparmentier.wifikeyshare.model.WifiNetwork.getSsidFromWifiConfiguration(WifiNetwork.java:76)
E/AndroidRuntime( 8372):    at be.brunoparmentier.wifikeyshare.model.WifiNetwork.fromWifiConfiguration(WifiNetwork.java:66)
E/AndroidRuntime( 8372):    at be.brunoparmentier.wifikeyshare.ui.activities.WifiListActivity$WifiListTask.doInBackground(WifiListActivity.java:313)
E/AndroidRuntime( 8372):    at be.brunoparmentier.wifikeyshare.ui.activities.WifiListActivity$WifiListTask.doInBackground(WifiListActivity.java:297)
E/AndroidRuntime( 8372):    at android.os.AsyncTask$2.call(AsyncTask.java:292)
E/AndroidRuntime( 8372):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime( 8372):    ... 4 more

Trying to get more info from user.