Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28fe2093 authored by Bjorn Bringert's avatar Bjorn Bringert
Browse files

Guard against NPE in SearchManagerService

Bug http://b/issue?id=2570569

Change-Id: I72395f847b3dbc699c73358e14421d624f40fcf3
parent 6e52b5d7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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,6 +552,7 @@ 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.