Merge "Fix b/243746796 Crash when mouse hangs over an empty battery chart" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6b5dc07b95
@@ -595,6 +595,9 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
|
||||
// Searches the corresponding trapezoid index from x location.
|
||||
private int getTrapezoidIndex(float x) {
|
||||
if (mTrapezoidSlots == null) {
|
||||
return BatteryChartViewModel.SELECTED_INDEX_INVALID;
|
||||
}
|
||||
for (int index = 0; index < mTrapezoidSlots.length; index++) {
|
||||
final TrapezoidSlot slot = mTrapezoidSlots[index];
|
||||
if (x >= slot.mLeft - mTrapezoidHOffset
|
||||
|
Reference in New Issue
Block a user