summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-03-18 22:17:55 (GMT)
committerNick Kralevich <nnk@google.com>2013-03-19 23:01:25 (GMT)
commit813a4bd48de33efe5c882ad3b9258e88d6d10fd7 (patch)
tree4fae6f9236984508fe07c53eae3e8871eb4c04d6
parent2b3202c3ff18469b294629bf1416118f12492173 (diff)
downloadandroid_packages_apps_PackageInstaller-813a4bd48de33efe5c882ad3b9258e88d6d10fd7.zip
android_packages_apps_PackageInstaller-813a4bd48de33efe5c882ad3b9258e88d6d10fd7.tar.gz
android_packages_apps_PackageInstaller-813a4bd48de33efe5c882ad3b9258e88d6d10fd7.tar.bz2
PackageUtil: don't collect certs if package doesn't exist
If packageParser.parsePackage() returns null, don't attempt call packageParser.collectCertificates(). This fixes a NPE triggered by the following command: am start -a android.intent.action.VIEW -d file:///blah/blah.apk -t application/vnd.android.package-archive Change-Id: I6f6f836734d4b4ee07e98ee6b1f6339fa675b8b0
-rw-r--r--src/com/android/packageinstaller/PackageUtil.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/com/android/packageinstaller/PackageUtil.java b/src/com/android/packageinstaller/PackageUtil.java
index 20dce43..5263b71 100644
--- a/src/com/android/packageinstaller/PackageUtil.java
+++ b/src/com/android/packageinstaller/PackageUtil.java
@@ -72,9 +72,12 @@ public class PackageUtil {
metrics.setToDefaults();
PackageParser.Package pkg = packageParser.parsePackage(sourceFile,
archiveFilePath, metrics, 0);
- packageParser.collectCertificates(pkg, 0);
- // Nuke the parser reference.
- packageParser = null;
+ if (pkg == null) {
+ return null;
+ }
+ if (!packageParser.collectCertificates(pkg, 0)) {
+ return null;
+ }
return pkg;
}