don't crash when launching an app that isn't installed

This fixes the following crash:

* Install an app form F-Droid
* go to home screen
* uninstall app
* quickly switch to F-Droid the button will still show 'run' for a few
seconds
* launch the app you just uninstalled
This commit is contained in:
Marcus Hoffmann 2018-03-20 16:22:31 +01:00
parent 9ffab6db0c
commit f32ed1eaed
No known key found for this signature in database
GPG Key ID: ACDF63BC43D5E530

View File

@ -736,7 +736,12 @@ public class AppDetails2 extends AppCompatActivity
@Override
public void launchApk() {
Intent intent = getPackageManager().getLaunchIntentForPackage(app.packageName);
startActivity(intent);
if (intent != null) {
startActivity(intent);
} else {
// This can happen when the app was just uninstalled.
Toast.makeText(this, R.string.app_not_installed, Toast.LENGTH_LONG).show();
}
}
@Override