From 51a309ba4758a1e5e60a2a37a461c9e7a92f3c34 Mon Sep 17 00:00:00 2001 From: bopol Date: Sun, 3 May 2020 14:44:32 +0200 Subject: [PATCH] fix NPE if one app set as default is uninstalled --- .../nitterizeme/activities/DefaultAppActivity.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/nitterizeme/activities/DefaultAppActivity.java b/app/src/main/java/app/fedilab/nitterizeme/activities/DefaultAppActivity.java index 2990057..a39f5f0 100644 --- a/app/src/main/java/app/fedilab/nitterizeme/activities/DefaultAppActivity.java +++ b/app/src/main/java/app/fedilab/nitterizeme/activities/DefaultAppActivity.java @@ -15,6 +15,7 @@ package app.fedilab.nitterizeme.activities; * see . */ +import android.content.pm.PackageInfo; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.MenuItem; @@ -82,8 +83,11 @@ public class DefaultAppActivity extends AppCompatActivity { if (packageName != null) { for (String p : packageName) { DefaultApp defaultApp = new DefaultApp(); - defaultApp.setApplicationInfo(Utils.getPackageInfo(DefaultAppActivity.this, p).applicationInfo); - appInfos.add(defaultApp); + PackageInfo packageInfo = Utils.getPackageInfo(this, p); + if (packageInfo != null) { + defaultApp.setApplicationInfo(packageInfo.applicationInfo); + appInfos.add(defaultApp); + } } } return appInfos;