From 2ffeab0c5e3fef0f0a4c3492b24a88f02596a3d5 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 17 Jul 2017 15:21:04 +0200 Subject: [PATCH] Fixed exception while handling notifications Summary: An exception occurred while processing non-repliable notifications Test Plan: Send a non-repliable notification, look in log for exception Reviewers: #kde_connect, albertvaka Reviewed By: #kde_connect, albertvaka Subscribers: apol, albertvaka, #kde_connect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D6740 --- .../NotificationsPlugin.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java index 3fb320f5..82a66b22 100644 --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java @@ -323,18 +323,20 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. Boolean reply = false; //works for WhatsApp, but not for Telegram - for(Notification.Action act : statusBarNotification.getNotification().actions) { - if(act != null && act.getRemoteInputs() != null) { - repliableNotification.remoteInputs.addAll(Arrays.asList(act.getRemoteInputs())); - repliableNotification.pendingIntent = act.actionIntent; - reply = true; - break; + if(statusBarNotification.getNotification().actions!=null) { + for (Notification.Action act : statusBarNotification.getNotification().actions) { + if (act != null && act.getRemoteInputs() != null) { + repliableNotification.remoteInputs.addAll(Arrays.asList(act.getRemoteInputs())); + repliableNotification.pendingIntent = act.actionIntent; + reply = true; + break; + } } + + repliableNotification.packageName = statusBarNotification.getPackageName(); + + repliableNotification.tag = statusBarNotification.getTag();//TODO find how to pass Tag with sending PendingIntent, might fix Hangout problem } - - repliableNotification.packageName = statusBarNotification.getPackageName(); - - repliableNotification.tag = statusBarNotification.getTag();//TODO find how to pass Tag with sending PendingIntent, might fix Hangout problem } catch(Exception e) { Log.w("NotificationPlugin","problem extracting notification wear for " + statusBarNotification.getNotification().tickerText); e.printStackTrace();