Assert that we have a socketEngine before calling it

If we are connected or bound, then we must have an engine.
Otherwise in code we frequently test for the d->socketEngine pointer,
including in waitForConnected.

Fixes static anlyzer warning 3b37ce4102843c97ceef2b7bb68a409d.

Pick-to: 6.1
Change-Id: Ib9818282ad2813db97859cbe1f184bcfb5ea4ab4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Volker Hilsheimer 2021-02-25 13:22:08 +01:00
parent 2de7f4f771
commit 2af45d0cee
1 changed files with 1 additions and 0 deletions

View File

@ -2197,6 +2197,7 @@ bool QAbstractSocket::waitForReadyRead(int msecs)
do {
if (state() != ConnectedState && state() != BoundState)
return false;
Q_ASSERT(d->socketEngine);
bool readyToRead = false;
bool readyToWrite = false;