getDeviceConnectivity 增加device判空

This commit is contained in:
zhangyuanyuan1 2023-06-20 17:17:07 +08:00
parent 8c406d4f5d
commit 599f1d4744
1 changed files with 1 additions and 1 deletions

View File

@ -256,7 +256,7 @@ void KyNetworkDeviceResourse::getDeviceConnectivity(const QString &deviceName, N
QString dbusPath; QString dbusPath;
NetworkManager::Device::Ptr connectDevice = NetworkManager::Device::Ptr connectDevice =
m_networkResourceInstance->findDeviceInterface(deviceName); m_networkResourceInstance->findDeviceInterface(deviceName);
if (connectDevice->isValid()) { if (connectDevice != nullptr && connectDevice->isValid()) {
dbusPath = connectDevice->uni(); dbusPath = connectDevice->uni();
} else { } else {
qWarning() << "[KyNetworkDeviceResourse] can not find device " << deviceName; qWarning() << "[KyNetworkDeviceResourse] can not find device " << deviceName;