diff options
author | junjiez <junjiez@codeaurora.org> | 2016-08-30 16:56:00 +0800 |
---|---|---|
committer | junjiez <junjiez@codeaurora.org> | 2016-08-30 16:56:00 +0800 |
commit | a6f532ac9c1465d2a80768d01b5ad3d0331446ec (patch) | |
tree | 03a110e657344998303cb7bbef3c061178d2ab58 /src/com/android/camera/ListPreference.java | |
parent | 9159ebde9c1bc74e531bd0cc5e7e9379d1d235e6 (diff) | |
download | android_packages_apps_Snap-a6f532ac9c1465d2a80768d01b5ad3d0331446ec.tar.gz android_packages_apps_Snap-a6f532ac9c1465d2a80768d01b5ad3d0331446ec.tar.bz2 android_packages_apps_Snap-a6f532ac9c1465d2a80768d01b5ad3d0331446ec.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() { |