Avoid package receiver NPE crashes. Fixes #380.

This commit is contained in:
Daniel Martí 2015-08-19 11:17:27 -07:00
parent 968b35f324
commit 3f5b5ffc93
3 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,8 @@
* Fix privileged installer confirmation screen issues on Android 2.X/3.X/4.X
* Fix a few crashes, including package receivers and NFC actions
### 0.95.1 (2015-08-10)
* Disable prompt to install F-Droid into system until it's more stable

View File

@ -43,6 +43,10 @@ public class PackageAddedReceiver extends PackageReceiver {
@Override
protected void handle(Context context, String appId) {
PackageInfo info = getPackageInfo(context, appId);
if (info == null) {
Log.d(TAG, "Could not get package info on '" + appId + "' - skipping.");
return;
}
Log.d(TAG, "Inserting installed app info for '" + appId + "' (v" + info.versionCode + ")");

View File

@ -45,6 +45,10 @@ public class PackageUpgradedReceiver extends PackageReceiver {
@Override
protected void handle(Context context, String appId) {
PackageInfo info = getPackageInfo(context, appId);
if (info == null) {
Log.d(TAG, "Could not get package info on '" + appId + "' - skipping.");
return;
}
Log.d(TAG, "Updating installed app info for '" + appId + "' to v" + info.versionCode + " (" + info.versionName + ")");