winrt: Set error if host cannot be found in QHostInfoAgent::fromName

Task-number: QTBUG-49478
Change-Id: Iab745100621db51219a42d575020783f6e9f310a
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
bb10
Oliver Wolff 2015-11-18 13:03:55 +01:00
parent fecbe76d6e
commit c63dbf8419
1 changed files with 6 additions and 1 deletions

View File

@ -49,6 +49,8 @@ using namespace ABI::Windows::Networking::Sockets;
QT_BEGIN_NAMESPACE
#define E_NO_SUCH_HOST 0x80072af9
//#define QHOSTINFO_DEBUG
QHostInfo QHostInfoAgent::fromName(const QString &hostName)
@ -98,8 +100,11 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
return results;
}
if (!endpointPairs)
if (hr == E_NO_SUCH_HOST || !endpointPairs) {
results.setError(QHostInfo::HostNotFound);
results.setErrorString(tr("Host %1 could not be found.").arg(hostName));
return results;
}
unsigned int size;
endpointPairs->get_Size(&size);