[Android] prevent NPE

Geoffrey Métais git at videolan.org
Mon Aug 7 12:02:28 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Aug  7 10:11:16 2017 +0200| [bec2a67a1b928616dab5970f7ffcd4360f832773] | committer: Geoffrey Métais

prevent NPE

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 4f0734e3c..54935f611 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -969,8 +969,10 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         } else {
             /* Show audio player */
             final Intent notificationIntent = getPackageManager().getLaunchIntentForPackage(getPackageName());
-            notificationIntent.setAction(AudioPlayerContainerActivity.ACTION_SHOW_PLAYER);
-            notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+            if (notificationIntent != null) {
+                notificationIntent.setAction(AudioPlayerContainerActivity.ACTION_SHOW_PLAYER);
+                notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+            }
             return PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
         }
     }



More information about the Android mailing list