diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/networkinformation/networklistmanager/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/plugins/networkinformation/networklistmanager/CMakeLists.txt b/src/plugins/networkinformation/networklistmanager/CMakeLists.txt index d927d4af60..2fb65377d4 100644 --- a/src/plugins/networkinformation/networklistmanager/CMakeLists.txt +++ b/src/plugins/networkinformation/networklistmanager/CMakeLists.txt @@ -3,6 +3,7 @@ qt_internal_add_plugin(QNLMNIPlugin CLASS_NAME QNetworkListManagerNetworkInformationBackendFactory PLUGIN_TYPE networkinformation DEFAULT_IF WIN32 AND QT_FEATURE_networklistmanager + EXCEPTIONS SOURCES qnetworklistmanagernetworkinformationbackend.cpp qnetworklistmanagerevents.h qnetworklistmanagerevents.cpp diff --git a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp index 5af75a89d5..787259fd65 100644 --- a/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp +++ b/src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp @@ -186,7 +186,12 @@ QNetworkInformation::TransportMedium getTransportMedium(const ConnectionProfile if (profile.IsWlanConnectionProfile()) return QNetworkInformation::TransportMedium::WiFi; - NetworkAdapter adapter = profile.NetworkAdapter(); + NetworkAdapter adapter(nullptr); + try { + adapter = profile.NetworkAdapter(); + } catch (...) { + // pass, we will return Unknown anyway + } if (adapter == nullptr) return QNetworkInformation::TransportMedium::Unknown; @@ -209,7 +214,14 @@ QNetworkInformation::TransportMedium getTransportMedium(const ConnectionProfile [[nodiscard]] bool getMetered(const ConnectionProfile &profile) { - ConnectionCost cost = profile.GetConnectionCost(); + ConnectionCost cost(nullptr); + try { + cost = profile.GetConnectionCost(); + } catch (...) { + // pass, we return false if we get an empty object back anyway + } + if (cost == nullptr) + return false; NetworkCostType type = cost.NetworkCostType(); return type == NetworkCostType::Fixed || type == NetworkCostType::Variable; } |