diff --git a/core/java/com/android/internal/os/PowerProfile.java b/core/java/com/android/internal/os/PowerProfile.java index d3fe582ab4bd6..9d0cb0115ee40 100644 --- a/core/java/com/android/internal/os/PowerProfile.java +++ b/core/java/com/android/internal/os/PowerProfile.java @@ -393,6 +393,9 @@ public class PowerProfile { } public int getNumCoresInCpuCluster(int cluster) { + if (cluster < 0 || cluster >= mCpuClusters.length) { + return 0; // index out of bound + } return mCpuClusters[cluster].numCpus; }