summaryrefslogtreecommitdiffstats
path: root/tests/auto/networkselftest
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@sosco.com>2009-10-26 14:43:55 (GMT)
committerShane Kearns <shane.kearns@sosco.com>2009-10-26 14:43:55 (GMT)
commit32815bd71b08f1a8bbec04e60a973a1fa2d9febe (patch)
treeae78d56d15e1ea4e36c5464cb6a5cd74e4287b68 /tests/auto/networkselftest
parentf3854db64bcaa0f26faf5ff1414d3b9ccfc00e35 (diff)
downloadQt-32815bd71b08f1a8bbec04e60a973a1fa2d9febe.zip
Qt-32815bd71b08f1a8bbec04e60a973a1fa2d9febe.tar.gz
Qt-32815bd71b08f1a8bbec04e60a973a1fa2d9febe.tar.bz2
Make network self test fail instead of crashing in case of DNS error
Reviewed-by: Liang QI Reviewed-by: Aleksandar Sasha Babic
Diffstat (limited to 'tests/auto/networkselftest')
-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;