Browse Source

Try to fix null context

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 years ago
parent
commit
32e3203034
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/src/main/java/com/nextcloud/talk/utils/NotificationUtils.java

+ 2 - 1
app/src/main/java/com/nextcloud/talk/utils/NotificationUtils.java

@@ -76,7 +76,8 @@ public class NotificationUtils {
     }
 
     public static void cancelExistingNotifications(Context context, UserEntity conversationUser) {
-        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M && conversationUser.getId() != -1) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M && conversationUser.getId() != -1 &&
+                context != null) {
 
             NotificationManager notificationManager =
                     (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);