summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormingwax <mingwax@codeaurora.org>2016-09-05 15:10:43 +0800
committerArne Coucheron <arco68@gmail.com>2017-06-13 07:16:35 +0200
commitf8703933e5f433ed95b5e87c2e6b20e6905205af (patch)
tree8b024cdaf0e641b3edc9e98f854598cc405dd26a
parent367758c24f18ea83a17a5ce600a043876b7af11d (diff)
downloadandroid_packages_apps_Snap-f8703933e5f433ed95b5e87c2e6b20e6905205af.zip
android_packages_apps_Snap-f8703933e5f433ed95b5e87c2e6b20e6905205af.tar.gz
android_packages_apps_Snap-f8703933e5f433ed95b5e87c2e6b20e6905205af.tar.bz2
SnapdragonCamera: Fix OutOfBoundsException in monkey test
In monkey test, set defaultValue operation in xml file, parsing XML in framework code, pref.getValue() return null when defaultValue not ready. When findIndexOfValue() failed to get the index of the value, it will return -1, but -1 can`t be the index of the array, it will cause exception. So if can`t find the index of the value, just go back and don`t execute the following code. Change-Id: I2b5595d7d558e3ab3863287e3d1424df141c5d59 CRs-Fixed: 1063228
-rw-r--r--src/com/android/camera/VideoMenu.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java
index 1ac3677..750fc70 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -435,6 +435,9 @@ public class VideoMenu extends MenuController
int resid = -1;
int index = pref.findIndexOfValue(pref.getValue());
if (!pref.getUseSingleIcon() && iconIds != null) {
+ if (index == -1) {
+ return;
+ }
// Each entry has a corresponding icon.
index = index % iconIds.length;
resid = iconIds[index];