QHostInfo::lookupHost: do not violate lookupHostImpl preconditions
lookupHostImpl requires either `receiver` or `slotObj` to be non-null. Since this code path deals with the string-based slots, `slotObj` is going to be null, therefore check that `receiver` is non-null. For completeness: also check that `member` is non-null. Emit a warning (à la QObject::connect) in case the user did something wrong. Change-Id: Ic6dcd51d7ddd977b121484369b1aef48844364c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a2e731e7e2
commit
5e2f22f8a1
@ -225,6 +225,10 @@ static int nextId()
|
||||
*/
|
||||
int QHostInfo::lookupHost(const QString &name, QT7_ONLY(const) QObject *receiver, const char *member)
|
||||
{
|
||||
if (!receiver || !member) {
|
||||
qWarning("QHostInfo::lookupHost: both the receiver and the member to invoke must be non-null");
|
||||
return -1;
|
||||
}
|
||||
return QHostInfo::lookupHostImpl(name, receiver, nullptr, member);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user