[Android] Prevent NPE with notification pendingIntent

Geoffrey Métais git at videolan.org
Tue Oct 10 09:05:25 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct 10 09:05:01 2017 +0200| [803e5c8c1e5bf68dcb6f1e9a21d41e1d0e6ed285] | committer: Geoffrey Métais

Prevent NPE with notification pendingIntent

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index cad881f21..20ae8145d 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -992,11 +992,9 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
             return PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
         } else {
             /* Show audio player */
-            final Intent notificationIntent = getPackageManager().getLaunchIntentForPackage(getPackageName());
-            if (notificationIntent != null) {
-                notificationIntent.setAction(AudioPlayerContainerActivity.ACTION_SHOW_PLAYER);
-                notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
-            }
+            final Intent notificationIntent = new Intent(this, StartActivity.class);
+            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