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.
This commit is contained in:
Peter Serwylo 2016-02-26 09:16:00 +11:00
parent ddbd9e2ea9
commit 18f97602e8

View File

@ -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")