[Android] Prevent NPE in playbackservice

Geoffrey Métais git at videolan.org
Wed Nov 22 16:08:29 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Nov 22 14:57:43 2017 +0100| [8e97e1cc7eb6ff345a472fdd9940bf390ee83302] | committer: Geoffrey Métais

Prevent NPE in playbackservice

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

 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 217046d88..57a92ddb0 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -984,7 +984,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
                                 while (ExecutorHolder.updateMeta.get())
                                     ExecutorHolder.updateMeta.wait();
                             } catch (InterruptedException ignored) {}
-                            final MediaMetadataCompat metaData = mMediaSession.getController().getMetadata();
+                            final MediaMetadataCompat metaData = mMediaSession != null ? mMediaSession.getController().getMetadata() : null;
                             title = metaData == null ? mw.getTitle() : metaData.getString(MediaMetadataCompat.METADATA_KEY_TITLE);
                             artist = metaData == null ? mw.getArtist() : metaData.getString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST);
                             album = metaData == null ? mw.getAlbum() : metaData.getString(MediaMetadataCompat.METADATA_KEY_ALBUM);



More information about the Android mailing list