summaryrefslogtreecommitdiffstats
path: root/tests/auto/networkselftest/tst_networkselftest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/networkselftest/tst_networkselftest.cpp')
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index d58402b..a09d998 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -333,6 +333,11 @@ QHostAddress tst_NetworkSelfTest::serverIpAddress()
if (cachedIpAddress.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol) {
// need resolving
QHostInfo resolved = QHostInfo::fromName(QtNetworkSettings::serverName());
+ if(resolved.error() != QHostInfo::NoError ||
+ !resolved.addresses().isEmpty()) {
+ qWarning("QHostInfo::fromName failed (%d).", resolved.error());
+ return QHostAddress(QHostAddress::Null);
+ }
cachedIpAddress = resolved.addresses().first();
}
return cachedIpAddress;