[Android] Check player has media before getting video tracks

Geoffrey Métais git at videolan.org
Fri Nov 10 11:06:52 CET 2017


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Nov 10 10:50:49 2017 +0100| [5ea1e16cf349fa37d474603920368c8603aeefcd] | committer: Geoffrey Métais

Check player has media before getting video tracks

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

 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 11aaca431..5c92893f2 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -2452,7 +2452,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
 
     @MainThread
     public int getVideoTracksCount() {
-        return mMediaPlayer.getVideoTracksCount();
+        return hasCurrentMedia() ? mMediaPlayer.getVideoTracksCount() : 0;
     }
 
     @MainThread



More information about the Android mailing list