Uninstalling an apk no longer in repo causes crash
- F-Droid version: 0.103.2 + 0.104
- F-Droid privileged extension version (if installed): N/A
This has ocured for several users who have reported via ACRA (almost 100 at last count).
What did you do? (clear steps if possible)
- Enable GP repo + GP Archive repo.
- Install an old version of Orbot
- Disable the GP ARchive repo.
- Go to AppDetails for Orbot and tap "Uninstall".
You could do this with any app or repo, the goal is just to get an app installed which is no longer in the rpeo, then try to uninstall it.
What did you expect to see?
Should uninstall as expected.
What did you see instead?
Crashes with the following stack trace:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.endsWith(java.lang.String)' on a null object reference
at org.fdroid.fdroid.installer.InstallerFactory.create(InstallerFactory.java:50)
at org.fdroid.fdroid.AppDetails2.uninstallApk(AppDetails2.java:784)
at org.fdroid.fdroid.views.AppDetailsRecyclerViewAdapter$3.onClick(AppDetailsRecyclerViewAdapter.java:968)
at android.view.View.performClick(View.java:5637)
Cause
AppDetails2#uninstallApk()
invokes AppDetails2#getInstalledApk()
when trying to uninstall an app that is not in our database due to no longer being in the repo. This gets passed to InstallerManager#create()
, which presumes that there is an apk.apkName
available. However, because AppDetails2#getInstalledApk()
hacked together as much detail as possible from the PackageManager
in lieu of the database, it wasn't able to come up with an apkName
.
CC: @cde, as it was introduced when checking the apk extension ends with ".apk".