summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2015-04-14 00:35:03 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-14 00:35:03 +0000
commit1770f9cfa546dbacb622550ef845c2dcb7f9b995 (patch)
tree4019ba980750e81291db0662b9cf95343982c1a8 /core
parent7591574d8490e0c985a73372607addccb2b0282f (diff)
parent3afca74a2a40b4e957630909fe5df76aa550da69 (diff)
downloadframeworks_base-1770f9cfa546dbacb622550ef845c2dcb7f9b995.zip
frameworks_base-1770f9cfa546dbacb622550ef845c2dcb7f9b995.tar.gz
frameworks_base-1770f9cfa546dbacb622550ef845c2dcb7f9b995.tar.bz2
am 3afca74a: Merge "BatteryStats: Adds an additional condition to avoid ArrayIndexOutOfBounds."
* commit '3afca74a2a40b4e957630909fe5df76aa550da69': BatteryStats: Adds an additional condition to avoid ArrayIndexOutOfBounds.
Diffstat (limited to 'core')
-rw-r--r--core/java/com/android/internal/os/PowerProfile.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/com/android/internal/os/PowerProfile.java b/core/java/com/android/internal/os/PowerProfile.java
index b3bafa1..1038acf 100644
--- a/core/java/com/android/internal/os/PowerProfile.java
+++ b/core/java/com/android/internal/os/PowerProfile.java
@@ -256,7 +256,7 @@ public class PowerProfile {
final Double[] values = (Double[]) data;
if (values.length > level && level >= 0) {
return values[level];
- } else if (level < 0) {
+ } else if (level < 0 || values.length == 0) {
return 0;
} else {
return values[values.length - 1];