QNetworkInformation[win]: Capture another potential exception

As reported by a user.

Fixes: QTBUG-108382
Pick-to: 6.4
Change-Id: Ic94c65d533edd84c8fda5d713d9579a9492b88ae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Mårten Nordheim 2022-11-11 22:30:16 +01:00
parent 64bb83f882
commit da0587c43a

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));