Fixed crash in QAuthenticator::operator==
[ChangeLog][QtNetwork][QAuthenticator] Fixed crash when comparing a initialized QAuthenticator with an uninitialized QAuthenticator. Task-number: QTBUG-53338 Change-Id: Ib8b732b9c65c02ee542885e5d6fe9bd1589a6b1a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
This commit is contained in:
parent
2852a8b87e
commit
2ac3fab45f
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user