prevent crash when starting swap on devices without Bluetooth/WiFi

This was introduced in f90b030e76ddb03e00bc0d46977c01c1bae3936d
This commit is contained in:
Hans-Christoph Steiner 2018-04-17 14:32:10 +02:00
parent c42d7164cf
commit 21e3124b5f

View File

@ -537,11 +537,11 @@ public class SwapService extends Service {
Preferences.get().unregisterLocalRepoHttpsListeners(httpsEnabledListener);
LocalBroadcastManager.getInstance(this).unregisterReceiver(onWifiChange);
if (!SwapService.wasBluetoothEnabledBeforeSwap()) {
if (bluetoothAdapter != null && !wasBluetoothEnabledBeforeSwap()) {
bluetoothAdapter.disable();
}
if (!SwapService.wasWifiEnabledBeforeSwap()) {
if (wifiManager != null && !wasWifiEnabledBeforeSwap()) {
wifiManager.setWifiEnabled(false);
}