Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Commit

Permalink
fix NFE
Browse files Browse the repository at this point in the history
  • Loading branch information
hundeva committed Aug 12, 2018
1 parent 4bef29e commit 6368b9d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ private static void parsePackageXml(Context context, String packageName, Compone
}

if (resource != null) {
parseXml = resourcesForApplication.getXml(Integer.parseInt(resource.substring(1)));
int resId = resourcesForApplication.getIdentifier(resource, null, packageName);
parseXml = resourcesForApplication.getXml(resId == 0 ? Integer.parseInt(resource.substring(1)) : resId);
while ((eventType = parseXml.nextToken()) != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG) {
if (parseXml.getName().equals("shortcut")) {
Expand All @@ -139,7 +140,7 @@ private static void parsePackageXml(Context context, String packageName, Compone
}
}
}
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException | XmlPullParserException | IOException e) {
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException | XmlPullParserException | IOException | NumberFormatException e) {
e.printStackTrace();
}
}
Expand Down

0 comments on commit 6368b9d

Please sign in to comment.