[Android] SearchFragment: fix a possible ArrayIndexOutOfBoundsException

Adrien Maglo git at videolan.org
Wed Apr 9 09:24:11 CEST 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Wed Apr  9 09:24:04 2014 +0200| [a90088626dd190785d1dcb7fe47bbecdab4dc90e] | committer: Adrien Maglo

SearchFragment: fix a possible ArrayIndexOutOfBoundsException

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=a90088626dd190785d1dcb7fe47bbecdab4dc90e
---

 vlc-android/src/org/videolan/vlc/gui/SearchFragment.java |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java b/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
index e08b2df..71d01c2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
@@ -136,7 +136,6 @@ public class SearchFragment extends SherlockListFragment {
     }
 
     private void showSearchHistory() {
-
         // Add header to the history
         String headerText = getString(R.string.search_history);
         showListHeader(headerText);
@@ -205,7 +204,7 @@ public class SearchFragment extends SherlockListFragment {
             db.addSearchhistoryItem(mSearchText.getText().toString());
 
             // open media in the player
-            Media item = (Media) getListAdapter().getItem(position - 1);
+            Media item = (Media) getListView().getItemAtPosition(position);
             if (item.getType() == Media.TYPE_VIDEO) {
                 VideoPlayerActivity.start(getActivity(), item.getLocation());
             } else {



More information about the Android mailing list