Fix a monkey crash: guard against position -1.

When handling onClick in ManageApplications, skip getAppEntry if
position is -1.

Change-Id: I565c42b2c9f742445e49fd4c2e7db539d0f6f8ad
Fixes: 67940121
Test: manual
This commit is contained in:
Fan Zhang
2017-10-18 11:47:01 -07:00
parent 78369d91bc
commit 5d80fd2966

View File

@@ -647,6 +647,10 @@ public class ManageApplications extends InstrumentedPreferenceFragment
}
final int position = mRecyclerView.getChildAdapterPosition(view);
if (position == RecyclerView.NO_POSITION) {
Log.w(TAG, "Cannot find position for child, skipping onClick handling");
return;
}
if (mApplications.getApplicationCount() > position) {
ApplicationsState.AppEntry entry = mApplications.getAppEntry(position);
mCurrentPkgName = entry.info.packageName;