[Android] VideoPlayerActivity: avoid a crash for files not in the database

Edward Wang git at videolan.org
Sun Dec 9 04:30:01 CET 2012


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Dec  8 20:46:27 2012 -0500| [991f5b92443e37b58b03313e5486a7c35e6ee6a8] | committer: Edward Wang

VideoPlayerActivity: avoid a crash for files not in the database

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java  |   10 ++++++----
 1 file changed, 6 insertions(+), 4 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 721f6ea..ad33960 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1261,11 +1261,13 @@ public class VideoPlayerActivity extends Activity {
         if (mLocation != null && mLocation.length() > 0 && !dontParse) {
             // restore last position
             Media media = DatabaseManager.getInstance(this).getMedia(this, mLocation);
-            if (media != null && media.getTime() > 0 && !fromStart)
-                mLibVLC.setTime(media.getTime());
+            if(media != null) {
+                if(media.getTime() > 0 && !fromStart)
+                    mLibVLC.setTime(media.getTime());
 
-            mLastAudioTrack = media.getAudioTrack();
-            mLastSpuTrack = media.getSpuTrack();
+                mLastAudioTrack = media.getAudioTrack();
+                mLastSpuTrack = media.getSpuTrack();
+            }
 
             try {
                 title = URLDecoder.decode(mLocation, "UTF-8");



More information about the Android mailing list