Fix bug #15827043 - Stability: CursorIndexOutOfBoundsException in Settings: Index -1 requested, with a size of 38

- ahhhh Monkeys, do not allow to have position < 0

Similar fix than the one done for:

mSuggestionsListView.setOnItemClickListener(...) in I3a8ded4c1471a1589134826539c9db1b551f49dd

Change-Id: I6ef266852e2c2ab5d0d0f6b4faf358b22d12bf6b
This commit is contained in:
Fabrice Di Meglio
2014-06-23 16:33:39 -07:00
parent 47a25e7640
commit f24859cdb7

View File

@@ -169,6 +169,12 @@ public class SearchResultsSummary extends Fragment {
// We have a header, so we need to decrement the position by one
position--;
// Some Monkeys could create a case where they were probably clicking on the
// List Header and thus the position passed was "0" and then by decrement was "-1"
if (position < 0) {
return;
}
final Cursor cursor = mResultsAdapter.mCursor;
cursor.moveToPosition(position);