fix NPE if one app set as default is uninstalled

This commit is contained in:
bopol 2020-05-03 14:44:32 +02:00
parent 0a72325ee5
commit 51a309ba47
1 changed files with 6 additions and 2 deletions

View File

@ -15,6 +15,7 @@ package app.fedilab.nitterizeme.activities;
* see <http://www.gnu.org/licenses>. */
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;