diff options
author | Ruchi Kandoi <kandoiruchi@google.com> | 2015-04-14 00:17:09 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-14 00:17:14 +0000 |
commit | 3afca74a2a40b4e957630909fe5df76aa550da69 (patch) | |
tree | b57e6bcd527837ff59771255f78fb2488959cb6d /core | |
parent | 07cd641b6f832f939d5cccfe8604c230ddad4257 (diff) | |
parent | be9cbb12e93c521ff0ef256658422720f5c3f55e (diff) | |
download | frameworks_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.java | 2 |
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]; |