summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2016-10-22 13:12:46 +0200
committerDaniel Hillenbrand <codeworkx@cyanogenmod.org>2016-11-04 13:18:38 -0700
commit70edacf3224f4e712b4b0427e84130ea83b95087 (patch)
tree2d7f9aaa36f84acd75959e6357de4c4b8993b7d4
parent3da1aa3b6b69710ed41ba78f01005b7cd172942f (diff)
downloadandroid_packages_apps_Snap-70edacf3224f4e712b4b0427e84130ea83b95087.zip
android_packages_apps_Snap-70edacf3224f4e712b4b0427e84130ea83b95087.tar.gz
android_packages_apps_Snap-70edacf3224f4e712b4b0427e84130ea83b95087.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 Change-Id: Ifa80077c2090a9df449be608feaf4390c875ff0f Reference: BugDumps 13-20161014-20 L#40 (cherry picked from commit beec60c940e6a50046d4c7c469b9381492f8b77a)
-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 6670253..8cfd369 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -430,7 +430,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 {