summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2015-04-14 00:17:09 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-14 00:17:14 +0000
commit3afca74a2a40b4e957630909fe5df76aa550da69 (patch)
treeb57e6bcd527837ff59771255f78fb2488959cb6d /core
parent07cd641b6f832f939d5cccfe8604c230ddad4257 (diff)
parentbe9cbb12e93c521ff0ef256658422720f5c3f55e (diff)
downloadframeworks_base-3afca74a2a40b4e957630909fe5df76aa550da69.zip
frameworks_base-3afca74a2a40b4e957630909fe5df76aa550da69.tar.gz
frameworks_base-3afca74a2a40b4e957630909fe5df76aa550da69.tar.bz2
Merge "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];