From f24859cdb76c840a9ff97a4ccc1e4a2753d565a6 Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Mon, 23 Jun 2014 16:33:39 -0700 Subject: [PATCH] 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 --- .../android/settings/dashboard/SearchResultsSummary.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/android/settings/dashboard/SearchResultsSummary.java b/src/com/android/settings/dashboard/SearchResultsSummary.java index 5af602e5a15..9e843576145 100644 --- a/src/com/android/settings/dashboard/SearchResultsSummary.java +++ b/src/com/android/settings/dashboard/SearchResultsSummary.java @@ -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);