summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bluetoothsettings/bluez/bluetoothdevice_p.cpp3
-rw-r--r--src/settingsui/bluetooth/Bluetooth.qml1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp b/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp
index 28ed605..4705ac4 100644
--- a/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp
+++ b/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp
@@ -67,6 +67,9 @@ bool BluetoothDevicePrivate::powered() const
void BluetoothDevicePrivate::setPowered(const bool& aPowered)
{
+ if (!m_localDevice)
+ return;
+
if (aPowered) {
m_localDevice->powerOn();
}
diff --git a/src/settingsui/bluetooth/Bluetooth.qml b/src/settingsui/bluetooth/Bluetooth.qml
index 60ee017..13572a8 100644
--- a/src/settingsui/bluetooth/Bluetooth.qml
+++ b/src/settingsui/bluetooth/Bluetooth.qml
@@ -54,6 +54,7 @@ Item {
indicatorWidth: root.width * 0.15
indicatorHeight: root.height * 0.06
+ enabled: BtDevice.available
checked: BtDevice.powered
onCheckedChanged: BtDevice.powered = checked
}