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
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user