summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bjorn Bringert <bringert@android.com> 2010-04-06 08:53:12 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-04-06 08:53:12 -0700
commit7d2511b722808dfc9cadd3f0f49375fcb738df56 (patch)
treee5a7523cbef106fe2f05dd56f5a9f60506c46e8b
parentfa588fc37420a1a4d287e6307700ca310897308a (diff)
parent28fe20930e4749a7d34bb438047c0647f775cf67 (diff)
Merge "Guard against NPE in SearchManagerService" into froyo
-rw-r--r--core/java/android/app/SearchableInfo.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/app/SearchableInfo.java b/core/java/android/app/SearchableInfo.java
index 0cdf971f988d..5482f605ec8f 100644
--- a/core/java/android/app/SearchableInfo.java
+++ b/core/java/android/app/SearchableInfo.java
@@ -258,9 +258,9 @@ public final class SearchableInfo implements Parcelable {
try {
theirContext = context.createPackageContext(activity.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
- // unexpected, but we deal with this by null-checking theirContext
+ Log.e(LOG_TAG, "Package not found " + activity.getPackageName());
} catch (java.lang.SecurityException e) {
- // unexpected, but we deal with this by null-checking theirContext
+ Log.e(LOG_TAG, "Can't make context for " + activity.getPackageName(), e);
}
return theirContext;
@@ -552,7 +552,8 @@ public final class SearchableInfo implements Parcelable {
final ComponentName cName) {
SearchableInfo result = null;
Context activityContext = createActivityContext(context, cName);
-
+ if (activityContext == null) return null;
+
// in order to use the attributes mechanism, we have to walk the parser
// forward through the file until it's reading the tag of interest.
try {