Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be9cbb12 authored by Ruchi Kandoi's avatar Ruchi Kandoi
Browse files

BatteryStats: Adds an additional condition to avoid

ArrayIndexOutOfBounds.

This change takes care of the case when the length
of the array is 0.

Bug: 16039301
Change-Id: Ideb3ccc723c5d720069760aeedae8abb91c6420d
parent b5e05cff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -251,7 +251,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];