@@ -283,6 +283,10 @@ static void handleNotification(final Context context, final Bundle message) {
283283 * Put the message into a notification and post it.
284284 */
285285 private static void showNotification (Context context , Bundle message ) {
286+ if (context == null || message == null ) {
287+ return ;
288+ }
289+
286290 NotificationManager notificationManager = (NotificationManager )
287291 context .getSystemService (Context .NOTIFICATION_SERVICE );
288292
@@ -346,7 +350,15 @@ private static void showNotification(Context context, Bundle message) {
346350 notificationId = value .hashCode ();
347351 }
348352 }
349- notificationManager .notify (notificationId , builder .build ());
353+
354+ try {
355+ notificationManager .notify (notificationId , builder .build ());
356+ } catch (NullPointerException e ) {
357+ Log .e ("Unable to show push notification." , e );
358+ } catch (Throwable t ) {
359+ Log .e ("Unable to show push notification." , t );
360+ Util .handleException (t );
361+ }
350362 }
351363
352364 static void openNotification (Context context , final Bundle notification ) {
@@ -375,6 +387,9 @@ static void openNotification(Context context, final Bundle notification) {
375387
376388 if (shouldStartActivity ) {
377389 Intent actionIntent = getActionIntent (context );
390+ if (actionIntent == null ) {
391+ return ;
392+ }
378393 actionIntent .putExtras (notification );
379394 actionIntent .addFlags (
380395 Intent .FLAG_ACTIVITY_CLEAR_TOP |
0 commit comments