diff options
author | junjiez <junjiez@codeaurora.org> | 2016-08-30 16:56:00 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-09-08 18:46:40 -0700 |
commit | d6c0dff6447c4a546096533592b8998d28f23822 (patch) | |
tree | 0faa5f96908156ff714174dddd8eef372efdbb13 /src/com/android/camera/ListPreference.java | |
parent | 050fe78517519b689ce5adff1cf2c074bcbd186e (diff) | |
download | android_packages_apps_Snap-d6c0dff6447c4a546096533592b8998d28f23822.tar.gz android_packages_apps_Snap-d6c0dff6447c4a546096533592b8998d28f23822.tar.bz2 android_packages_apps_Snap-d6c0dff6447c4a546096533592b8998d28f23822.zip |
SnapdragonCamera:Fix OutOfBoundsException in monkey test
when findIndexOfValue() failed to get the index of the value,
it will return -1,but -1 can't be the index of the arry,it will
cause exception.So if can't find the index of the value,return
the default support value instead.
Change-Id: I2cd44a20146b35492b5c697c2c4ba5a6cd0cd095
CRs-Fixed: 1060916
Diffstat (limited to 'src/com/android/camera/ListPreference.java')
-rw-r--r-- | src/com/android/camera/ListPreference.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/camera/ListPreference.java b/src/com/android/camera/ListPreference.java index 000baf125..722e958b2 100644 --- a/src/com/android/camera/ListPreference.java +++ b/src/com/android/camera/ListPreference.java @@ -171,7 +171,11 @@ public class ListPreference extends CameraPreference { } public String getEntry() { - return mEntries[findIndexOfValue(getValue())].toString(); + int index = findIndexOfValue(getValue()); + if(index < 0) { + return findSupportedDefaultValue(); + } + return mEntries[index].toString(); } public String getLabel() { |