HTTP/2: Don't handle Remote Disconnected if we haven't switched yet

In that case we haven't created the h2 handler yet, so it will
crash when trying to access various members.

Task-number: QTBUG-85902
Change-Id: Id0699ff06ef67748a16622703f731db0b0867771
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Mårten Nordheim 2020-08-11 11:28:21 +02:00
parent 7448884bb4
commit 27b1d1a1b2

View File

@ -979,7 +979,8 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
// this check is under this condition in 'if'):
if (protocolHandler.data()) {
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct
|| connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
|| (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
&& switchedToHttp2)) {
auto h2Handler = static_cast<QHttp2ProtocolHandler *>(protocolHandler.data());
h2Handler->handleConnectionClosure();
protocolHandler.reset();