Merge "Fix a monkey crash: guard against position -1."

This commit is contained in:
TreeHugger Robot
2017-10-18 20:27:45 +00:00
committed by Android (Google) Code Review

View File

@@ -647,6 +647,10 @@ public class ManageApplications extends InstrumentedPreferenceFragment
} }
final int position = mRecyclerView.getChildAdapterPosition(view); 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) { if (mApplications.getApplicationCount() > position) {
ApplicationsState.AppEntry entry = mApplications.getAppEntry(position); ApplicationsState.AppEntry entry = mApplications.getAppEntry(position);
mCurrentPkgName = entry.info.packageName; mCurrentPkgName = entry.info.packageName;