QNetworkInformation[win]: Capture another potential exception

As reported by a user.

Fixes: QTBUG-108382
Change-Id: Ic94c65d533edd84c8fda5d713d9579a9492b88ae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit da0587c43a611cd5d74119ee4a62d0a8767b4d8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2022-11-11 22:30:16 +01:00 committed by Qt Cherry-pick Bot
parent 7cb3fa767d
commit afd88fba7d

View File

@ -243,7 +243,12 @@ QNetworkInformation::TransportMedium getTransportMedium(const ConnectionProfile
void QNetworkListManagerEvents::emitWinRTUpdates()
{
using namespace winrt::Windows::Networking::Connectivity;
ConnectionProfile profile = NetworkInformation::GetInternetConnectionProfile();
ConnectionProfile profile = nullptr;
try {
profile = NetworkInformation::GetInternetConnectionProfile();
} catch (...) {
// pass, we would just return early if we get an empty object back anyway
}
if (profile == nullptr)
return;
emit transportMediumChanged(getTransportMedium(profile));