winrt: do not try to close non existent sockets

Change-Id: I41103db89985f8fbde1faaccaf33c7a76c275f7d
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
This commit is contained in:
Oliver Wolff 2014-05-07 13:35:42 +02:00 committed by The Qt Project
parent 7e44e4bb4e
commit 9cd7403801

View File

@ -475,9 +475,9 @@ void QNativeSocketEngine::close()
Q_D(QNativeSocketEngine);
if (d->socketDescriptor != -1) {
IClosable *socket = 0;
if (d->socketType == QAbstractSocket::TcpSocket)
if (d->socketType == QAbstractSocket::TcpSocket && d->tcp)
d->tcp->QueryInterface(IID_PPV_ARGS(&socket));
else if (d->socketType == QAbstractSocket::UdpSocket)
else if (d->socketType == QAbstractSocket::UdpSocket && d->udp)
d->udp->QueryInterface(IID_PPV_ARGS(&socket));
if (socket) {