CappielloAntonio / tempo

An open source and lightweight music client for Subsonic, designed and built natively for Android.
GNU General Public License v3.0
877 stars 39 forks source link

App not loading when no internet connection available #24

Closed osmose991 closed 11 months ago

osmose991 commented 11 months ago

Thanks for this apps, we really like it here. Better than most music apps with subsonic api.

Problem : When there's no wifi available and no data connection (cellular) The app is not loading and crash at start. (It's still works if loaded before losing internet access)

Step to reproduce :

  1. Flush apps in memory
  2. Turn off wifi
  3. Turn off LTE
  4. Open the app (Should close automatically)

Crash details :

type: crash
osVersion: google/bluejay/bluejay:13/TQ3A.230705.001/2023072600:user/release-keys
package: com.cappielloantonio.tempo:14
process: com.cappielloantonio.tempo
processUptime: 168 + 384 ms
installer: com.android.packageinstaller

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cappielloantonio.tempo/com.cappielloantonio.tempo.ui.activity.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.net.NetworkInfo.getType()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3655)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:138)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2313)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ExecInit.main(ExecInit.java:49)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.net.NetworkInfo.getType()' on a null object reference
at com.cappielloantonio.tempo.ui.activity.MainActivity.onCreate(MainActivity.java:369)
at android.app.Activity.performCreate(Activity.java:8389)
at android.app.Activity.performCreate(Activity.java:8368)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1422)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3636)
... 14 more

Thanks in advance

CappielloAntonio commented 11 months ago

Hello, could you reproduce the crash with an unsigned apk to have a more readable crashlog? I can't reproduce the problem and I've made a slight change that may affect the behavior of that part of the system.

app-notquitemy-debug.zip

osmose991 commented 11 months ago

Hi, I've been trying your app from the previous post, and it's working normally. I can't reproduce the crash with this app (app-notquitemy-debug.zip). So your slight changes seem to be working great.

CappielloAntonio commented 11 months ago

Great!