From 4a9028aedd9a666e08b8b7aa63038c3dc7c5bf86 Mon Sep 17 00:00:00 2001
From: Jake McGinty <me@jake.su>
Date: Mon, 13 Apr 2015 13:36:30 -0700
Subject: [PATCH] only set non-null bitmaps for notifications

Fixes #2960
Closes #2979

// FREEBIE
---
 .../securesms/notifications/MessageNotifier.java       | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java
index 254801a17f..123cee1fd9 100644
--- a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java
+++ b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java
@@ -24,6 +24,7 @@ import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.database.Cursor;
+import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Color;
 import android.media.AudioManager;
@@ -175,12 +176,13 @@ public class MessageNotifier {
       return;
     }
 
-    List<NotificationItem>notifications = notificationState.getNotifications();
-    NotificationCompat.Builder builder  = new NotificationCompat.Builder(context);
-    Recipient recipient                 = notifications.get(0).getIndividualRecipient();
+    List<NotificationItem>     notifications  = notificationState.getNotifications();
+    NotificationCompat.Builder builder        = new NotificationCompat.Builder(context);
+    Recipient                  recipient      = notifications.get(0).getIndividualRecipient();
+    Bitmap                     recipientPhoto = recipient.getContactPhoto();
 
     builder.setSmallIcon(R.drawable.icon_notification);
-    builder.setLargeIcon(recipient.getContactPhoto());
+    if (recipientPhoto != null) builder.setLargeIcon(recipientPhoto);
     builder.setContentTitle(recipient.toShortString());
     builder.setContentText(notifications.get(0).getText());
     builder.setContentIntent(notifications.get(0).getPendingIntent(context));