Fix crashing debug message
authorShane Kearns <ext-shane.2.kearns@nokia.com>
Mon, 30 Jan 2012 14:35:12 +0000 (14:35 +0000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 30 Jan 2012 19:18:44 +0000 (20:18 +0100)
The debug message could derefence a null pointer, this crashed when
running ssl autotests

Change-Id: I176aaa9f3cf3c6cc1512cdc34db06d4c79f92e73
Reviewed-by: Richard J. Moore <rich@kde.org>
src/network/socket/qabstractsocket.cpp

index 6264ee4..b6d0733 100644 (file)
@@ -811,7 +811,7 @@ bool QAbstractSocketPrivate::flush()
         && socketEngine->bytesToWrite() == 0)) {
 #if defined (QABSTRACTSOCKET_DEBUG)
     qDebug("QAbstractSocketPrivate::flush() nothing to do: valid ? %s, writeBuffer.isEmpty() ? %s",
-           socketEngine->isValid() ? "yes" : "no", writeBuffer.isEmpty() ? "yes" : "no");
+           (socketEngine && socketEngine->isValid()) ? "yes" : "no", writeBuffer.isEmpty() ? "yes" : "no");
 #endif
 
         // this covers the case when the buffer was empty, but we had to wait for the socket engine to finish