treehouses / remote

⚡ control Raspberry Pi from Android Device through Bluetooth ⚡
https://play.google.com/store/apps/details?id=io.treehouses.remote
GNU Affero General Public License v3.0
64 stars 29 forks source link

the app crashes sometimes when pressing "connect to rpi" #127

Closed i5o closed 5 years ago

i5o commented 5 years ago

i think it's after the connection has been established

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: io.treehouses.remote, PID: 15966
    java.lang.RuntimeException: Error receiving broadcast Intent { act=android.bluetooth.device.action.FOUND flg=0x10 (has extras) } in io.treehouses.remote.Fragments.RPIDialogFragment$3@9fade12
        at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1401)
        at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6692)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
        at android.view.LayoutInflater.from(LayoutInflater.java:229)
        at android.widget.ArrayAdapter.<init>(ArrayAdapter.java:212)
        at android.widget.ArrayAdapter.<init>(ArrayAdapter.java:206)
        at android.widget.ArrayAdapter.<init>(ArrayAdapter.java:192)
        at io.treehouses.remote.Fragments.RPIDialogFragment$3.onReceive(RPIDialogFragment.java:200)
        at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1391)
        at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6692) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
I/Process: Sending signal. PID: 15966 SIG: 9
Application terminated.
Sriharsha-Singam commented 5 years ago

It does crash whenever click on the "connect to rpi" more than once. It does not matter if it connects or not. It has something to do with the ArrayAdapter for the ListView and getContext()