Handle some Exceptions caused eg. by missing network during shutdown#342
Conversation
|
I should have a look at fixing this at the source instead of catching the exceptions afterwards. |
|
This would be of course the best solution. Might be a little bit complicated to reproduce. It's a mix between "disconnect network" and closing the player+session. An often happening situation on mobile devices and will likely also affect the new Android-project of librespot-java. |
|
I remember having dealt with that before, having a closer look now. |
|
@funtax Do you have stacktraces for those NullPointerExceptions? I cannot keep them |
|
They might be useless because they happen at another position now and are extracted from "Android Vitals". java.lang.NullPointerException: java.lang.NullPointerException: And the one within sendUnchecked() might be triggered by "conn" set to "null" during Session.close() and thus might happen at several positions during closing the session. |
|
I should probably refactor that part of the code at some point, but for now this should do. |
If you close the player for example during missing network or while a reconnect is in progress, some issues might occur and cause uncaught Exceptions.
This PR fixes the most occurring issues.
This might especially be required if you use librespot-java on a mobile client like Android.