QHostInfo::lookupHostImpl: add another precondition check

If `member` is set it means that the caller wants us to connect
to a slot using string-based connections. That means `receiver`
must be non-null as well. Check for it.

Change-Id: I6b3542855147e95fecbf4c645b556c2047a1ed69
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2023-09-04 20:13:24 +02:00
parent afe158b936
commit c63de2cda3

View File

@ -750,6 +750,7 @@ int QHostInfo::lookupHostImpl(const QString &name,
#endif
Q_ASSERT(!member != !slotObj); // one of these must be set, but not both
Q_ASSERT(receiver || slotObj);
Q_ASSERT(!member || receiver); // if member is set, also is receiver
if (!QAbstractEventDispatcher::instance(QThread::currentThread())) {
qWarning("QHostInfo::lookupHost() called with no event dispatcher");