[Android] VideoPlayer: check moveToFirst() to avoid crash

Jean-Baptiste Kempf git at videolan.org
Sat Mar 9 18:36:22 CET 2013


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Mar  9 18:36:01 2013 +0100| [24a191a6a2d20c83349e5938c185ee48ab2c5f38] | committer: Jean-Baptiste Kempf

VideoPlayer: check moveToFirst() to avoid crash

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java        |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 1ea60cd..5f2dad7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1345,8 +1345,8 @@ public class VideoPlayerActivity extends Activity {
                     // Media URI
                     Cursor cursor = managedQuery(getIntent().getData(), new String[]{ MediaStore.Video.Media.DATA }, null, null, null);
                     int column_index = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
-                    cursor.moveToFirst();
-                    mLocation = Util.PathToURI(cursor.getString(column_index));
+                    if (cursor.moveToFirst())
+                        mLocation = Util.PathToURI(cursor.getString(column_index));
                 } else {
                     // other content-based URI (probably file pickers)
                     mLocation = getIntent().getData().getPath();



More information about the Android mailing list