Merge "Fix b/243746796 Crash when mouse hangs over an empty battery chart" into tm-qpr-dev am: 6b5dc07b95
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/19745373 Change-Id: If0db0c59dce301909f6a1d7d5f4453fb04a2c1d4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -595,6 +595,9 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
|||||||
|
|
||||||
// Searches the corresponding trapezoid index from x location.
|
// Searches the corresponding trapezoid index from x location.
|
||||||
private int getTrapezoidIndex(float x) {
|
private int getTrapezoidIndex(float x) {
|
||||||
|
if (mTrapezoidSlots == null) {
|
||||||
|
return BatteryChartViewModel.SELECTED_INDEX_INVALID;
|
||||||
|
}
|
||||||
for (int index = 0; index < mTrapezoidSlots.length; index++) {
|
for (int index = 0; index < mTrapezoidSlots.length; index++) {
|
||||||
final TrapezoidSlot slot = mTrapezoidSlots[index];
|
final TrapezoidSlot slot = mTrapezoidSlots[index];
|
||||||
if (x >= slot.mLeft - mTrapezoidHOffset
|
if (x >= slot.mLeft - mTrapezoidHOffset
|
||||||
|
Reference in New Issue
Block a user