[Android] Return length value of 0 when no media

Geoffrey Métais git at videolan.org
Tue Jan 16 15:38:31 CET 2018


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 16 15:08:53 2018 +0100| [aec1f976a4c863974db702b077400bdf8e8783fe] | committer: Geoffrey Métais

Return length value of 0 when no media

(cherry picked from commit 2b13ca0925006c0c47592752432d9f3bc5747b2a)

> https://code.videolan.org/videolan/vlc-android/commit/aec1f976a4c863974db702b077400bdf8e8783fe
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 1d456f8fb..27885a689 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1920,7 +1920,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
 
     @MainThread
     public long getLength() {
-        return  mMediaPlayer.getLength();
+        return  hasMedia() ? mMediaPlayer.getLength() : 0;
     }
 
     /**



More information about the Android mailing list