Skip to content

App crashes on close if connected via WiFi and PSLab is turned off #2700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
marcnause opened this issue May 22, 2025 · 0 comments · May be fixed by #2701
Open

App crashes on close if connected via WiFi and PSLab is turned off #2700

marcnause opened this issue May 22, 2025 · 0 comments · May be fixed by #2701
Assignees
Labels
Bug Unexpected problem or unintended behavior in app

Comments

@marcnause
Copy link
Contributor

marcnause commented May 22, 2025

Actual Behaviour
The app crashes if the app was connected to the PSLab via WiFi, PSLab is turned off and app is closed.

Expected Behaviour
The app should never crash.

Steps to reproduce it
0. Power on PSLab with ESP01

  1. Connect app to PSLab via WiFi
  2. Power off PSLab
  3. Wait until phone notices that WiFi is offline and app shows disconnect message
  4. Close app

---> Crash

FATAL EXCEPTION: main
Process: io.pslab, PID: 16813
java.lang.RuntimeException: Unable to destroy activity {io.pslab/io.pslab.activity.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.pslab.communication.CommunicationHandler.close()' on a null object reference
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4244)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4262)
at android.app.ActivityThread.-wrap6(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1551)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.pslab.communication.CommunicationHandler.close()' on a null object reference
at io.pslab.communication.ScienceLab.disconnect(ScienceLab.java:2910)
at io.pslab.activity.MainActivity.onDestroy(MainActivity.java:520)
at android.app.Activity.performDestroy(Activity.java:6889)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1175)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4231)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4262) 
at android.app.ActivityThread.-wrap6(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1551) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6165) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)

Screenshots of the issue
Video: https://github.com/user-attachments/assets/99412b60-40d6-461a-a9aa-4dc043c279ab

Would you like to work on the issue?
Yes, I will open a PR in a short time.

@marcnause marcnause self-assigned this May 22, 2025
@marcnause marcnause added the Bug Unexpected problem or unintended behavior in app label May 22, 2025
@marcnause marcnause linked a pull request May 22, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected problem or unintended behavior in app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant