[Android] Prevent NPE with getLaunchIntentForPackage
Geoffrey Métais
git at videolan.org
Wed Oct 4 14:40:04 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct 4 14:21:35 2017 +0200| [51a9d0f76958949666e86cf89803e57f2bd02b03] | committer: Geoffrey Métais
Prevent NPE with getLaunchIntentForPackage
> https://code.videolan.org/videolan/vlc-android/commit/51a9d0f76958949666e86cf89803e57f2bd02b03
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index bcbb24839..093100425 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -473,7 +473,9 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
* Launch the activity if needed
*/
if (action.startsWith(ACTION_REMOTE_GENERIC) && !mMediaPlayer.isPlaying() && !hasCurrentMedia()) {
- context.startActivity(getPackageManager().getLaunchIntentForPackage(getPackageName()));
+ final Intent activityIntent = getPackageManager().getLaunchIntentForPackage(getPackageName());
+ if (activityIntent != null)
+ context.startActivity(activityIntent);
}
/*
More information about the Android
mailing list