Issue 5166: Prevent crash at start
Description
Prevent App Lounge would crash at start in some rare cases.
Issue(s)
https://gitlab.e.foundation/e/backlog/-/issues/5166
Test environment
Gradle build against 5166-crash_at_start branch, install the apk into the device
Test procedures
This crash is somewhat related to https://gitlab.e.foundation/e/backlog/-/issues/4924
This crash happens very rarely and could not be reliably reproduced.
The best chance of getting this crash:
- Freshly install App Lounge.
- Accept TOS.
- Close App Lounge, force stop from App Info screen.
- Re-open app lounge. Now
HomeFragment
should callSignInFragment
and here is the best chance where it might have crashed before this code change.
Technical details
This crash probably happens because navigation controller is called multiple times is quick succession from HomeFragment.onTosAccepted()
.
To prevent that, a function NavController.safeNavigate
is added.
Source: https://nezspencer.medium.com/navigation-components-a-fix-for-navigation-action-cannot-be-found-in-the-current-destination-95b63e16152e
Also the code is wrapped in try-catch to be sure.
Screenshots
Check list
-
Self review -
Test procedure explained -
Tested on fresh install -
Tested applied as an update -
License -
Internal documentation -
User documentation