winrt: no assert when device is in airplane mode/has no internet connection

Task-number: QTBUG-49478
Change-Id: I1b95ca736d454f82f84374554e6cdec2555d29de
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
This commit is contained in:
Oliver Wolff 2015-11-18 11:03:20 +01:00
parent 2ab6963e95
commit fecbe76d6e
2 changed files with 6 additions and 0 deletions

View File

@ -76,6 +76,9 @@ static QNetworkInterfacePrivate *interfaceFromProfile(IConnectionProfile *profil
ComPtr<INetworkAdapter> adapter;
hr = profile->get_NetworkAdapter(&adapter);
// Indicates that no internet connection is available/the device is in airplane mode
if (hr == E_INVALIDARG)
return 0;
Q_ASSERT_SUCCEEDED(hr);
UINT32 type;
hr = adapter->get_IanaInterfaceType(&type);

View File

@ -201,6 +201,9 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf
ComPtr<INetworkAdapter> adapter;
hr = profile->get_NetworkAdapter(&adapter);
// Indicates that no internet connection is available/the device is in airplane mode
if (hr == E_INVALIDARG)
return QNetworkConfiguration::BearerUnknown;
Q_ASSERT_SUCCEEDED(hr);
GUID id;
hr = adapter->get_NetworkAdapterId(&id);