[Android] Check player has media before getting video tracks

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


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

Check player has media before getting video tracks

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

 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