Fix offline mode crash if already connected
This commit is contained in:
parent
ff35e2d152
commit
3ca336d4da
@ -175,7 +175,7 @@ void Core::evaluateNetworkManagerState(const NetworkManager::NetworkManagerState
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Note: if the wireless device is in the access point mode, the bluetooth server should stop
|
// Note: if the wireless device is in the access point mode, the bluetooth server should stop
|
||||||
if (m_wirelessDevice->mode() == WirelessNetworkDevice::ModeAccessPoint) {
|
if (m_wirelessDevice && m_wirelessDevice->mode() == WirelessNetworkDevice::ModeAccessPoint) {
|
||||||
stopService();
|
stopService();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -237,10 +237,10 @@ void Core::startService()
|
|||||||
|
|
||||||
void Core::stopService()
|
void Core::stopService()
|
||||||
{
|
{
|
||||||
if (m_bluetoothServer->running())
|
if (m_bluetoothServer && m_bluetoothServer->running()) {
|
||||||
qCDebug(dcApplication()) << "Stop bluetooth service";
|
qCDebug(dcApplication()) << "Stop bluetooth service";
|
||||||
|
m_bluetoothServer->stop();
|
||||||
m_bluetoothServer->stop();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::onAdvertisingTimeout()
|
void Core::onAdvertisingTimeout()
|
||||||
@ -354,6 +354,9 @@ void Core::onNetworkManagerWirelessEnabledChanged(bool enabled)
|
|||||||
void Core::onNetworkManagerStateChanged(const NetworkManager::NetworkManagerState &state)
|
void Core::onNetworkManagerStateChanged(const NetworkManager::NetworkManagerState &state)
|
||||||
{
|
{
|
||||||
qCDebug(dcApplication()) << state;
|
qCDebug(dcApplication()) << state;
|
||||||
|
if (!m_bluetoothServer)
|
||||||
|
return;
|
||||||
|
|
||||||
m_bluetoothServer->onNetworkManagerStateChanged(state);
|
m_bluetoothServer->onNetworkManagerStateChanged(state);
|
||||||
evaluateNetworkManagerState(state);
|
evaluateNetworkManagerState(state);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user