diff options
-rw-r--r-- | ui/src/main/java/com/wireguard/android/model/TunnelManager.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/ui/src/main/java/com/wireguard/android/model/TunnelManager.java b/ui/src/main/java/com/wireguard/android/model/TunnelManager.java index e1806c2f..c7c75b98 100644 --- a/ui/src/main/java/com/wireguard/android/model/TunnelManager.java +++ b/ui/src/main/java/com/wireguard/android/model/TunnelManager.java @@ -283,20 +283,27 @@ public final class TunnelManager extends BaseObservable { public void onReceive(final Context context, @Nullable final Intent intent) { Log.println(Log.INFO, TAG, "Broadcast received " + intent); final TunnelManager manager = Application.getTunnelManager(); - if (intent == null) + if (intent == null) { + Log.println(Log.INFO, TAG, "Null intent"); return; + } final String action = intent.getAction(); - if (action == null) + if (action == null) { + Log.println(Log.INFO, TAG, "Null action"); return; + } if ("com.wireguard.android.action.REFRESH_TUNNEL_STATES".equals(action)) { manager.refreshTunnelStates(); + Log.println(Log.INFO, TAG, "Refresh"); return; } final String tunnelName = intent.getStringExtra("tunnel"); - if (tunnelName == null) + if (tunnelName == null) { + Log.println(Log.INFO, TAG, "Null name"); return; + } if ("com.wireguard.android.action.SET_TUNNEL_UP".equals(action) || "com.wireguard.android.action.SET_TUNNEL_DOWN".equals(action)) { @@ -324,8 +331,10 @@ public final class TunnelManager extends BaseObservable { code = ActionCode.GET_CONFIG; manager.getTunnels().thenAccept(tunnels -> { final ObservableTunnel tunnel = tunnels.get(tunnelName); - if (tunnel == null) + if (tunnel == null) { + Log.println(Log.INFO, TAG, "Unknown tunnel: " + tunnelName); return; + } final String config = intent.getStringExtra("config"); try { @@ -340,8 +349,10 @@ public final class TunnelManager extends BaseObservable { Log.println(Log.ERROR, TAG, Log.getStackTraceString(e)); } }); - } else + } else { + Log.println(Log.INFO, TAG, "Unknown action: " + action); return; + } } } |