[app] Don't crash when trying to enable Wi-Fi

Fixes acra-crash-reports#741
This commit is contained in:
Torsten Grote
2024-09-10 09:39:44 -03:00
committed by Hans-Christoph Steiner
parent 9f637a602c
commit 650dc4432a

View File

@@ -492,7 +492,13 @@ public class SwapWorkflowActivity extends AppCompatActivity {
if (Build.VERSION.SDK_INT <= 28) {
wifiManager.setWifiEnabled(false);
}
if (wifiApControl.enable()) {
boolean wifiEnabled = false;
try {
wifiEnabled = wifiApControl.enable();
} catch (Exception e) {
Log.e(TAG, "Error enabling WiFi: ", e);
}
if (wifiEnabled) {
Toast.makeText(this, R.string.swap_toast_hotspot_enabled, Toast.LENGTH_SHORT).show();
SwapService.putHotspotActivatedUserPreference(true);
} else {