summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2016-10-22 11:12:46 (GMT)
committerAdrian DC <radian.dc@gmail.com>2016-12-03 21:12:09 (GMT)
commit7d16fdb5979cdf1e829c52fcdad2ec3391cd76bf (patch)
treeabf46ddcc760b79c3ac096b952d81ede0c7df7d3
parent5db8da4ce6c909f35bc5672210c6ef51b63ffc6c (diff)
downloadandroid_packages_apps_Snap-7d16fdb5979cdf1e829c52fcdad2ec3391cd76bf.zip
android_packages_apps_Snap-7d16fdb5979cdf1e829c52fcdad2ec3391cd76bf.tar.gz
android_packages_apps_Snap-7d16fdb5979cdf1e829c52fcdad2ec3391cd76bf.tar.bz2
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
-rw-r--r--src/com/android/camera/VideoMenu.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java
index 054db5d..4744ae2 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 {