From 18f97602e8b9ae8f791b5b135732265dcc4bab3a Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Fri, 26 Feb 2016 09:16:00 +1100 Subject: [PATCH] Don't start swap wifi when there is no network. Not sure if we should be here or not in this situation, so this is a little bit defensive. Can't bind to an IP address of `null`, so don't bother starting LocalHTTP server unless we have an IP. --- F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java b/F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java index 70634d28e..0ce4bcc4f 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java @@ -42,10 +42,14 @@ public class WifiSwap extends SwapType { @Override public void start() { - Utils.debugLog(TAG, "Preparing swap webserver."); sendBroadcast(SwapService.EXTRA_STARTING); + if (FDroidApp.ipAddressString == null) { + Log.e(TAG, "Not starting swap webserver, because we don't seem to be connected to a network."); + setConnected(false); + } + Runnable webServer = new Runnable() { // Tell Eclipse this is not a leak because of Looper use. @SuppressLint("HandlerLeak")