From 6368b9d4c5552520d6c2bc722c7a444fb1c982f4 Mon Sep 17 00:00:00 2001 From: hundeva Date: Sun, 12 Aug 2018 12:53:27 +0200 Subject: [PATCH] fix NFE --- .../launcher3/shortcuts/DeepShortcutManagerBackport.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutManagerBackport.java b/src/com/android/launcher3/shortcuts/DeepShortcutManagerBackport.java index 24ce892314..c28ef91f0d 100644 --- a/src/com/android/launcher3/shortcuts/DeepShortcutManagerBackport.java +++ b/src/com/android/launcher3/shortcuts/DeepShortcutManagerBackport.java @@ -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")) { @@ -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(); } }