summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network/kernel/qauthenticator.cpp2
-rw-r--r--tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp16
2 files changed, 18 insertions, 0 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 95994653e6..92d8779cab 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -193,6 +193,8 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const
{
if (d == other.d)
return true;
+ if (!d || !other.d)
+ return false;
return d->user == other.d->user
&& d->password == other.d->password
&& d->realm == other.d->realm
diff --git a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
index 026a2a2722..90a6aa5811 100644
--- a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
+++ b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
@@ -52,6 +52,8 @@ private Q_SLOTS:
void ntlmAuth_data();
void ntlmAuth();
+
+ void equalityOperators();
};
tst_QAuthenticator::tst_QAuthenticator()
@@ -152,6 +154,20 @@ void tst_QAuthenticator::ntlmAuth()
QVERIFY(priv->calculateResponse("GET", "/").startsWith("NTLM "));
}
+void tst_QAuthenticator::equalityOperators()
+{
+ QAuthenticator s1, s2;
+ QVERIFY(s2 == s1);
+ QVERIFY(s1 == s2);
+ QVERIFY(!(s1 != s2));
+ QVERIFY(!(s2 != s1));
+ s1.setUser("User");
+ QVERIFY(!(s2 == s1));
+ QVERIFY(!(s1 == s2));
+ QVERIFY(s1 != s2);
+ QVERIFY(s2 != s1);
+}
+
QTEST_MAIN(tst_QAuthenticator);
#include "tst_qauthenticator.moc"