From 7d16fdb5979cdf1e829c52fcdad2ec3391cd76bf Mon Sep 17 00:00:00 2001 From: Michael W Date: Sat, 22 Oct 2016 13:12:46 +0200 Subject: Snap: Fix possible RuntimeException (due to NPE) When the pref can't be found, index "-1" is returned, causing an NPE resulting in an RTE. Add check for a positive index before accessing the array RM-290 Change-Id: Ifa80077c2090a9df449be608feaf4390c875ff0f Reference: BugDumps 13-20161014-20 L#40 --- src/com/android/camera/VideoMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/com') diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java index 054db5d90..4744ae2f0 100644 --- a/src/com/android/camera/VideoMenu.java +++ b/src/com/android/camera/VideoMenu.java @@ -427,7 +427,7 @@ public class VideoMenu extends MenuController int[] iconIds = pref.getLargeIconIds(); int resid = -1; int index = pref.findIndexOfValue(pref.getValue()); - if (!pref.getUseSingleIcon() && iconIds != null) { + if (!pref.getUseSingleIcon() && iconIds != null && index >= 0) { // Each entry has a corresponding icon. resid = iconIds[index]; } else { -- cgit v1.2.3