From 9ffd90a85b357ca4f8663ac3e1a1df72f2715466 Mon Sep 17 00:00:00 2001 From: fbaron Date: Mon, 9 Oct 2023 09:05:44 -0700 Subject: [PATCH] Add NullPointerException to try/catch since it's possible to have such an error getShortcutIconDrawable could return null "Method invocation 'getShortcutIconDrawable' may produce 'NullPointerException'" and it leads to the code crashing. Adding NullPointerException as one of the exceptions in the try/catch would resolve this issue Fix: 299525046 Test: verify after merging that the null pointer exception stops occurring Flag: no flag Change-Id: I52cfba9c7b08ea4e1b0f4506c461e79c3e91dc6c (cherry picked from commit 7e6107caafab310ce81636847ce68bf85d83d2db) --- src/com/android/launcher3/icons/ShortcutCachingLogic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/icons/ShortcutCachingLogic.java b/src/com/android/launcher3/icons/ShortcutCachingLogic.java index bb7248fea7..17915394ae 100644 --- a/src/com/android/launcher3/icons/ShortcutCachingLogic.java +++ b/src/com/android/launcher3/icons/ShortcutCachingLogic.java @@ -107,7 +107,7 @@ public class ShortcutCachingLogic implements CachingLogic { try { return context.getSystemService(LauncherApps.class) .getShortcutIconDrawable(shortcutInfo, density); - } catch (SecurityException | IllegalStateException e) { + } catch (SecurityException | IllegalStateException | NullPointerException e) { Log.e(TAG, "Failed to get shortcut icon", e); return null; }