From 7759152eeb2af70065ed816b3fefd80b5f74ab04 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Thu, 2 Jun 2016 13:56:46 +0200 Subject: [PATCH] Do not swallow packets silently --- src/org/kde/kdeconnect/Device.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/org/kde/kdeconnect/Device.java b/src/org/kde/kdeconnect/Device.java index 86687edb..61850f4a 100644 --- a/src/org/kde/kdeconnect/Device.java +++ b/src/org/kde/kdeconnect/Device.java @@ -560,7 +560,7 @@ public class Device implements BaseLink.PackageReceiver { } else if (isPaired()) { ArrayList targetPlugins = pluginsByIncomingInterface.get(np.getType()); - if (targetPlugins != null) { + if (targetPlugins != null && !targetPlugins.isEmpty()) { for (String pluginKey : targetPlugins) { Plugin plugin = plugins.get(pluginKey); try { @@ -570,6 +570,8 @@ public class Device implements BaseLink.PackageReceiver { Log.e("KDE/Device", "Exception in " + plugin.getPluginKey() + "'s onPackageReceived()"); } } + } else { + Log.e("Device", "Ignoring packet with type " + np.getType() + " because no plugin can handle it"); } } else { @@ -582,7 +584,7 @@ public class Device implements BaseLink.PackageReceiver { unpair(); ArrayList targetPlugins = pluginsByIncomingInterface.get(np.getType()); - if (targetPlugins != null) { + if (targetPlugins != null && !targetPlugins.isEmpty()) { for (String pluginKey : targetPlugins) { Plugin plugin = plugins.get(pluginKey); try { @@ -592,6 +594,8 @@ public class Device implements BaseLink.PackageReceiver { Log.e("KDE/Device", "Exception in " + plugin.getDisplayName() + "'s onPackageReceived() in unPairedPackageListeners"); } } + } else { + Log.e("Device", "Ignoring packet with type " + np.getType() + " because no plugin can handle it"); } }