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.

Change-Id: Ib9818282ad2813db97859cbe1f184bcfb5ea4ab4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2af45d0cee253a6bc4e6807076445439cc69c2ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2021-02-25 13:22:08 +01:00 committed by Qt Cherry-pick Bot
parent c286ad4665
commit ad8b779cd7

View File

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